GH-917 Fix regression with sanitizing headers

Resolves #917
This commit is contained in:
Oleg Zhurakousky
2022-08-16 16:43:18 +02:00
parent e2bdc440d7
commit d222cb12d5
3 changed files with 7 additions and 3 deletions

View File

@@ -115,8 +115,9 @@ public class BeanFactoryAwareFunctionRegistry extends SimpleFunctionRegistry imp
functionDefinition = StringUtils.hasText(functionDefinition)
? functionDefinition
: this.applicationContext.getEnvironment().getProperty(FunctionProperties.FUNCTION_DEFINITION, "");
functionDefinition = this.normalizeFunctionDefinition(functionDefinition);
if (!this.applicationContext.containsBean(functionDefinition) || !KotlinDetector.isKotlinType(this.applicationContext.getBean(functionDefinition).getClass())) {
functionDefinition = this.normalizeFunctionDefinition(functionDefinition);
}
if (!StringUtils.hasText(functionDefinition)) {
logger.info("Can't determine default function definition. Please "
+ "use 'spring.cloud.function.definition' property to explicitly define it.");

View File

@@ -755,7 +755,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry {
}
else {
Map<String, Object> headersMap = new HashMap<>(((Message) result).getHeaders());
this.sanitizeHeaders(((Message) result).getHeaders()).forEach((k, v) -> headersMap.putIfAbsent(k, v));
this.sanitizeHeaders(((Message) input).getHeaders()).forEach((k, v) -> headersMap.putIfAbsent(k, v));
result = MessageBuilder.withPayload(((Message) result).getPayload()).copyHeaders(headersMap).build();
}
}