When receiving and processing data from applications within a DataPower response rule; there will be occasions when the backend does not populate a content-type header. This is not a strict requirement. For example, from RFC2616:
Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body.
However under certain DataPower rule configurations, primarily when a RESULT action is used, DataPower attempts to assume the content-type and inject a content-type header. This issue has been discussed and if not desired, remediation offered on various notes such as:
IBM WebSphere DataPower SOA Appliances injects Content-Type as "text/xml" if the client or server does not set this header which may cause unexpected behavior (http://www-01.ibm.com/support/docview.wss?uid=swg21470992 ).
Under some configurations this remediation may not be practical. With DataPower firmware 7.2 a new service variable has been added that provides an alternative to this behavior.
The variable controls whether the Content-Type header is preserved and under what conditions it can be modified, based on its value for each processing action and at the end of the processing rule.
It is described in the IBM Knowledge Center and setting to “1” enables the “don’t inject” behavior. And it is available within Gateway Script and XSLT. An example of its use within XSLT is shown below:
<!-- Don't create content-type headers if none supplied on response -->
<dp:set-variable name="'var://service/mpgw/proxy-content-type'" value="'1'"/>
Using this variable, DataPower will no longer inject a content-type header when none is received by the backend resource. Allowing user-agents, browsers and clients to process the response using assumptions as defined within the RFCs.