Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force text error template when exceptions occur
Rails by default shows nice error pages, with a lot of markup, css and javascript. This is cool when you visit the page in the browser, but not helpful when you consume the app as an API. Rails' HTML response then makes it really hard find the error when it's displayed as part of the exception message. But Rails will render a text-based exception when doing AJAX requests. By setting the `X-Requested-With` header we can make Rails show the text template for all requests. Note that there's still some markup in the error. This is a Rails bug, addressed in rails/rails#22172. I feel this is not a great solution. I'm planning on making a PR on Rails to show the text-template for all non-HTML requests.
- Loading branch information