Skip to content

Commit

Permalink
Fixing issue 2195 - order of if/else blocks is causing unit tests moc…
Browse files Browse the repository at this point in the history
…king XHR. (#2201)
  • Loading branch information
masterots authored and felipewmartins committed Sep 13, 2019
1 parent c454e9f commit 1b07fb9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/defaults.js
Expand Up @@ -15,13 +15,12 @@ function setContentTypeIfUnset(headers, value) {

function getDefaultAdapter() {
var adapter;
// Only Node.JS has a process variable that is of [[Class]] process
if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
// For node use HTTP adapter
adapter = require('./adapters/http');
} else if (typeof XMLHttpRequest !== 'undefined') {
if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
adapter = require('./adapters/xhr');
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
// For node use HTTP adapter
adapter = require('./adapters/http');
}
return adapter;
}
Expand Down

0 comments on commit 1b07fb9

Please sign in to comment.