GetData Response Headers

5.2.18+ 5.4.14+

It is now possible to add arbitrary headers to responses from GetData. If the first line of the response starts with ##Headers and then later has ## on a line by itself then GetData will try to parse the lines between as "header name", "header value" pairs, divided by a colon.
E.g.:

##Headers
Content-Type: text/csv
Content-Disposition : inline;filename=this_is_CSV.csv
##

This will set the Content-Type header to text/csv and the Content-Disposition header to inline;filename=this_is_CSV.csv meaning that the browser is told that the response is a CSV file and to handle accordingly.

For Content-Disposition, GetData will substitute a value of ##auto## with the value of the ds parameter in the request (i.e. the DataSource name).

So using the following for a request with ds=council_tax, means the filename will be set to council_tax.csv.

##Headers
Content-Type: text/csv
Content-Disposition : inline;filename=##auto##.csv
##

This can be used for XSL requests by adding the appropriate text at the beginning of the output text, e.g. just after the <xsl:template match="/"> tag.

See the new WebService\xml\atCSVDatatable_headers.xsl file for an example.

The following is a RSS example.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
  <xsl:template match="/">
<xsl:text>##Headers
Content-Type: application/rss+xml
Content-Disposition : inline;filename=##auto##.xml
##
</xsl:text>
   <rss version="2.0">
      <channel> 
       <title>My Title</title>