mirror of
https://github.com/tenrok/axios.git
synced 2026-05-27 14:47:43 +03:00
Merge pull request #279 from Deamon87/patch-1
Fixing xhr for webworker env
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ var buildURL = require('./../helpers/buildURL');
|
||||
var parseHeaders = require('./../helpers/parseHeaders');
|
||||
var transformData = require('./../helpers/transformData');
|
||||
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
||||
var btoa = window.btoa || require('./../helpers/btoa');
|
||||
var btoa = (typeof window !== 'undefined' && window.btoa) || require('./../helpers/btoa');
|
||||
|
||||
module.exports = function xhrAdapter(resolve, reject, config) {
|
||||
var requestData = config.data;
|
||||
@@ -22,7 +22,7 @@ module.exports = function xhrAdapter(resolve, reject, config) {
|
||||
// For IE 8/9 CORS support
|
||||
// Only supports POST and GET calls and doesn't returns the response headers.
|
||||
// DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
|
||||
if (process.env.NODE_ENV !== 'test' && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
|
||||
if (process.env.NODE_ENV !== 'test' && typeof window !== 'undefined' && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
|
||||
request = new window.XDomainRequest();
|
||||
loadEvent = 'onload';
|
||||
xDomain = true;
|
||||
|
||||
Reference in New Issue
Block a user