Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

http-outbound-gateway sets wrong content-type header

we migrated from SIv3.x to SIv4.0.4 and found that now the http-outbound-gateway sets wrongly the content-type header. Instead of setting it like this content-type, it sets it like contentType. Searching around I found that this may be because now SI uses Spring Messaging clases where this attribute is named contentType.

public static final String CONTENT_TYPE = "contentType";

Is there a way to set correctly this content-type in the http-outbound or maybe before using an object-to-json-transformer?

thanks in advance Regards Guzmán

like image 857
gllambi Avatar asked Jul 10 '26 00:07

gllambi


1 Answers

Well, I understand your point and it is really a bug, which we missed when migrate to the Spring Messaging.

Please, raise a JIRA ticket on the matter - and we have to map contentType message header to the Content-Type HTTP header.

Right now as a workaround you can re-map it 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 just before <int-http:outbound-gateway>

like image 149
Artem Bilan Avatar answered Jul 21 '26 04:07

Artem Bilan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!