ISAM for Web – Modify a Request Header

I posted about modifying a HTTP response back in June 2014 here.

This month, I had to put together a HTTP transformation rule that would update a Request header. In particular, the Request header was “out of spec” from the HTTP rules for a Content-Type.

It simply updated the request header.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
<!-- This is relevant to a request only. -->

<!-- Firstly, strip any space elements -->
<xsl:strip-space elements="*" />
<!--
    Perform a match on the root of the document. Output the required
    HTTPRequestChange elements and then process templates.
-->
<xsl:template match="/">
    <HTTPRequestChange>
        <xsl:apply-templates />
    </HTTPRequestChange>
</xsl:template>

<!--
    Match on the Headers. Any Header processing 
    should happen within this template.
-->
<xsl:template match="//HTTPRequest/Headers">
    <Header name="Content-Type" action="update">
          application/x-www-form-urlencoded
    </Header>
</xsl:template>


</xsl:stylesheet>

Very simple, but always handy to have some examples. Follow the steps from the previous article to put it to use – with one subtle change:

pop

In the POP, use the Value of “Request” to ensure that the transformation occurs on the Request, not the response.

Comments are closed.

Website Built with WordPress.com.

Up ↑

%d bloggers like this: