mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-03 12:27:30 -05:00
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:
commit
e18e320231
1 changed files with 8 additions and 4 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue