Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

adding xhr header #1

Merged
merged 1 commit into from Feb 12, 2014

Conversation

Projects
None yet
2 participants
Contributor

tylergraf commented Feb 11, 2014

Our error handler in express looks for req.xhr to be true if it's an XHR request. Currently when using FS.superagent the errors are html pages (500,503,404) instead of returning application/json.

According to http://expressjs.com/api.html#req.xhr, if we set this header, it sets the req.xhr to be true. I've tried setting this header in my request and it worked.

@dncrews dncrews added a commit that referenced this pull request Feb 12, 2014

@dncrews dncrews Merge pull request #1 from tylergraf/master
adding xhr header
c46eeb1

@dncrews dncrews merged commit c46eeb1 into fs-webdev:master Feb 12, 2014

Contributor

dncrews commented Feb 12, 2014

@tylergraf, I believe you want to fix that here: https://github.com/fs-webdev/theme-engage/blob/master/assets/js/base/superagent.js, since no one seemed to like it in this repository (Jamis), and I had to stick it directly in the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment