mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
Only apply X-Requested-With
to same domain
it breaks on cross domain
This commit is contained in:
parent
9c88f92f44
commit
fa2c326955
1 changed files with 3 additions and 3 deletions
|
@ -18,9 +18,7 @@ var urlParams = require('./url-params');
|
||||||
module.exports = function (opts, callback) {
|
module.exports = function (opts, callback) {
|
||||||
defaultsDeep(opts, {
|
defaultsDeep(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
|
||||||
});
|
});
|
||||||
|
@ -52,6 +50,8 @@ module.exports = function (opts, callback) {
|
||||||
opts.uri = parts[0] + '?' + qs;
|
opts.uri = parts[0] + '?' + qs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
opts['X-Requested-With'] = 'XMLHttpRequest';
|
||||||
}
|
}
|
||||||
xhr(opts, function (err, res, body) {
|
xhr(opts, function (err, res, body) {
|
||||||
if (err) log.error(err);
|
if (err) log.error(err);
|
||||||
|
|
Loading…
Reference in a new issue