If extensionDetection is enabled then this will also activate the extension detection via the accept-header
Every incoming HTTP request has a special Accept header that defines what media types (or mime types) a client can "accept". The default of / will be mapped by default to HTML which will be our default format
These types will be mapped in a new structure called mimeTypes that you can declare in your routes configuration file:
<pre><code>
mimeTypes = {
xml = "text/xml",
json = [ "/", "application/json" ]
};
</code></pre>
Once the header Accept is detected and it matches one of these maps, it will set the format request collection variable to the mapped incoming format.
Here is a quickly put together version that parses the Accept header after first checking for extensions:
https://gist.github.com/elpete/95282a913762a956e132609736c60660#file-ses-cfc-L40-L57
I think this is more than enough for this to be validated. Please look at comments in your gist