Rack middleware to strip HTTP accept headers

Strips HTTP_ACCEPT headers for all non XML HTTP requests

HTTP accept headers are generally implemented in such a broken way in the wild, see http://www.gethifi.com/blog/browser-rest-http-accept-headers that unless you really need them it is best to ignore them.

FAQ

  1. Why keep the HTTP accept headers for XML HTTP requests?

XML HTTP requests are often made from the javascript you have placed in web pages. In these cases you control the accept headers that are sent with the requests and so it is neat to be able to make use of these for content negotiation, so we leave them in.

  1. I want to turn off content negotiation entirely?

If you are using Rails v3.1 or greater and you want to turn off content negotiation entirely with

 ```ActionDispatch::Request.ignore_accept_header = true```

Once you have done this HTTP accept header values will be ignored.