KB Article #178097

Unable to use an Add HTTP Header filter to change the Content-Type header

Problem

* You are unable to use the 'Add HTTP Header' filter to change the Content-Type header.

Resolution

-- The content type is special because it is related to how the API Gateway internally stores the content.body attribute, specifically which of the subclasses of com.vordel.mime.Body the message will be parsed as.


As such, the only safe way to change the content type is to go through a Set Message filter using the new content type and setting the message value to ${content.body} as in the screenshot below. This will cause the body to be parsed again as the new content type and may change the Java class stored in content.body.



For further information on the com.vordel.mime.Body class, refer to the javadoc files found in /apigateway/docs/javadoc/