paypal/generator-kraken — pull request #61 by mstuart (2014-02-16 08:29:08+00:00)
Title: Fix controller generator so its compatible with IE8/9 out-of-the-box.

In IE8 and IE9, a typical Accept header for a plain GET request is: `"image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, */*"`

Unfortunately kraken controllers with the option to respond to XHR requests are causing a ruckus. Just a gosh darn ruckus, if you ask me.

A simple GET request to another route (clicking a link from the index page to another page) will resolve that accept header to json, which causes the browser to show a download pop up, rather than send back HTML.

The issue is that wildcard at the end. `*/*` falls back to the json directive.

Referencing this express issue: https://github.com/visionmedia/express/pull/1020
It's over a year old, but the general response is that IE8 is to blame.

Instead of using res.format, let's fallback to checking for xhr and the mime type ourselves. I tested it and this fixes the problem in IE8 and 9.

Btw, `req.accepts('json')` is a shortcut for application/json.

![ROOMBA](http://moar.edgecats.net/cats/anigif_enhanced-buzz-10181-1323295518-9.gif)