From 468e90993d4ee556a4cf414fb1d6b6f7b99ed98a Mon Sep 17 00:00:00 2001 From: "Andrew J. Pierce" Date: Thu, 2 Nov 2017 18:47:24 -0400 Subject: [PATCH] Move `window` defined check before window.XMLHttpRequest check --- lib/adapters/xhr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index 68fd329958..299ce77e88 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -24,9 +24,9 @@ module.exports = function xhrAdapter(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 (!window.XMLHttpRequest && - process.env.NODE_ENV !== 'test' && + if (process.env.NODE_ENV !== 'test' && typeof window !== 'undefined' && + !window.XMLHttpRequest && window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) { request = new window.XDomainRequest();