req.xhrA flag indicating whether the current request (req) appears to be an AJAX request (i.e. it was issued with its "X-Requested-With" header set to "XMLHttpRequest").
req.xhr;
if (req.xhr) {
// Yup, it's AJAX alright.
}
- Whenever possible, you should prefer the
req.wantsJSONflag. Avoid writing custom content negotiation logic into your app, as it makes your code more brittle and verbose.
If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.