In a situation where I have:
<int-http:outbound-gateway request-channel="dataHubRawDataUploadChannel"
id="raw" url-expression="headers['rawUrl']" http-method="POST"
extract-request-payload="true" header-mapper="headerMapper"
reply-channel="rawDataUploadResponseChannel" expected-response-type="java.lang.String"
error-handler="rawResponseErrorHandler" />
<int-http:outbound-gateway request-channel="canonicalHttpChannel"
id="canonical" url-expression="headers['canonicalUrl']"
http-method="POST" header-mapper="headerMapper" reply-channel="targetDataUploadChannel"
expected-response-type="java.lang.String" rest-template="customRestTemplate"/>
<int-http:outbound-gateway request-channel="targetHttpChannel"
id="target" url-expression="headers['targetUrl']"
http-method="POST" header-mapper="headerMapper" reply-channel="targetUploadResponseProcessor"
expected-response-type="java.lang.String" />
I face the following problem:
The headers of the first and second request are not cleared when sending the third request , resulting in a Http 400 response.
I tried to clean the headers but the only solution I found is to override the RestTemplate class responsible for the actual HTTP request and clear the headers there, which is an ugly solution.
Do you have a better way to do it with Spring Integration?