You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing order of conditions typeof window !== 'undefined' and !window.XMLHttpRequest fixes the error.
Context
axios version: 0.17.0
Environment: web worker in Chrome
Notes
looking closer ar xhr.js:
typeof window checks could be probably replaced with typeof XMLHttpRequest and typeof btoa
There is new XMLHttpRequest() few lines prior !window.XMLHttpRequest check. I would expect, in case !window.XMLHttpRequest is true, new XMLHttpRequest() will throw error before the check and the check is never performed
The text was updated successfully, but these errors were encountered:
Summary
After upgrade from 0.16.2 to 0.17.0 I got error
window is undefined
when running in web worker at line:axios/lib/adapters/xhr.js
Line 27 in 2c0e318
Changing order of conditions
typeof window !== 'undefined'
and!window.XMLHttpRequest
fixes the error.Context
Notes
looking closer ar xhr.js:
typeof window
checks could be probably replaced withtypeof XMLHttpRequest
andtypeof btoa
new XMLHttpRequest()
few lines prior!window.XMLHttpRequest
check. I would expect, in case!window.XMLHttpRequest
is true,new XMLHttpRequest()
will throw error before the check and the check is never performedThe text was updated successfully, but these errors were encountered: