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.
  • Loading branch information
jmelvin-r7 authored and G07cha committed Aug 13, 2019
1 parent 7101f76 commit 9031fb6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/defaults.js
Original file line number Diff line number Diff line change
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 9031fb6

Please sign in to comment.