Http-outbound-gateway is setting the wrong content type header
we migrated from SIv3.x to SIv4.0.4 and found that the HTTP outbound gateway now incorrectly sets the content type header. Instead of setting it as this content type, it sets it as contentType. Searching around I found it could be due to SI now using Spring Messaging cluster where this attribute is called contentType.
public static final String CONTENT_TYPE = "contentType";
Is there a way to properly set this content type in http outgoing, or perhaps before using the object-to-json transformer?
thanks in advance Regards Guzman
source to share
Well, I understand your point, and this is indeed a bug that we missed when porting to Spring Messaging.
Please raise a JIRA ticket on this issue - and we have to match the message header contentType
with the Content-Type
HTTP header.
As a workaround, you can re-map
manually:
<header-enricher>
<header name="#{T(org.springframework.http.HttpHeaders).CONTENT_TYPE}" expression="headers[#{T(org.springframework.messaging.MessageHeaders).CONTENT_TYPE}]"/>
</header-enricher>
And not before <obeject-to-json-transformer>
, but after and immediately before<int-http:outbound-gateway>
source to share