Commit e18e3202 authored by Matthew Taylor's avatar Matthew Taylor

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
parents 1df251ca d6d5fa0f
...@@ -16,15 +16,19 @@ var urlParams = require('./url-params'); ...@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment