rails/turbolinks — pull request #300 by blinkist (2013-11-19 09:41:38+00:00)
Title: Integrated header check for redirects via redirect_with_turbolinks to avoid plain body responses on non AJAX requests

As we got some troubles with *redirect_via_turbolinks* and plain text responses in some situations, I investigated on the problem and found this short snippet of code that doesn't distinguish between regular http requests and those sent via XMLHttpRequest.

With my fix, we never experienced a 200 response with *Turbolinks.visit(...)* in the body anymore. All regular non-AJAX requests got redirected perfectly by the browser. AJAX requests get the javascript response and execute the turbo links code.