We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 961ecd1 commit 0b3db5dCopy full SHA for 0b3db5d
lib/defaults.js
@@ -15,12 +15,13 @@ function setContentTypeIfUnset(headers, value) {
15
16
function getDefaultAdapter() {
17
var adapter;
18
- if (typeof XMLHttpRequest !== 'undefined') {
19
- // For browsers use XHR adapter
20
- adapter = require('./adapters/xhr');
21
- } else if (typeof process !== 'undefined') {
+ // Only Node.JS has a process variable that is of [[Class]] process
+ if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
22
// For node use HTTP adapter
23
adapter = require('./adapters/http');
+ } else if (typeof XMLHttpRequest !== 'undefined') {
+ // For browsers use XHR adapter
24
+ adapter = require('./adapters/xhr');
25
}
26
return adapter;
27
0 commit comments