GH-1063 Fix header propagation in composed function

Resolves #1063
This commit is contained in:
Oleg Zhurakousky
2023-09-25 13:11:59 +02:00
parent 1b0a5e38af
commit afb419d701
2 changed files with 32 additions and 0 deletions

View File

@@ -639,6 +639,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry {
@Override
public <V> Function<Object, V> andThen(Function<? super Object, ? extends V> after) {
Assert.isTrue(after instanceof FunctionInvocationWrapper, "Composed function must be an instanceof FunctionInvocationWrapper.");
if (FunctionTypeUtils.isMultipleArgumentType(this.inputType)
|| FunctionTypeUtils.isMultipleArgumentType(this.outputType)
|| FunctionTypeUtils.isMultipleArgumentType(((FunctionInvocationWrapper) after).inputType)
@@ -646,6 +647,8 @@ public class SimpleFunctionRegistry implements FunctionRegistry {
throw new UnsupportedOperationException("Composition of functions with multiple arguments is not supported at the moment");
}
this.setSkipOutputConversion(true);
((FunctionInvocationWrapper) after).setSkipOutputConversion(true);
Function rawComposedFunction = v -> ((FunctionInvocationWrapper) after).doApply(doApply(v));
FunctionInvocationWrapper afterWrapper = (FunctionInvocationWrapper) after;