Merge branch 'hotfix/gh-828' into develop

* hotfix/gh-828:
  Make `X-Requested-With` overridable
  use `defaults` again
  Only apply `X-Requested-With` to same domain
  check street number range for address

# Conflicts:
#	src/lib/api.js
This commit is contained in:
Matthew Taylor 2016-08-11 15:45:05 -04:00
commit e18e320231

View file

@ -16,15 +16,19 @@ var urlParams = require('./url-params');
*/ */
module.exports = function (opts, callback) { module.exports = function (opts, callback) {
defaultsDeep(opts, { defaults(opts, {
host: process.env.API_HOST, host: process.env.API_HOST,
headers: { headers: {},
'X-Requested-With': 'XMLHttpRequest'
},
responseType: 'json', responseType: 'json',
useCsrf: false useCsrf: false
}); });
if (opts.host === '') {
defaults(opts.headers, {
'X-Requested-With': 'XMLHttpRequest'
});
}
opts.uri = opts.host + opts.uri; opts.uri = opts.host + opts.uri;
if (opts.params) { if (opts.params) {