Skip to content

Commit

Permalink
Merge pull request #13 from fed135/hotfix/failing-xhr-tests
Browse files Browse the repository at this point in the history
Order of if/else blocks is causing unit tests mocking XHR
  • Loading branch information
fed135 committed Aug 16, 2019
2 parents 7101f76 + 9031fb6 commit d000ac7
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 d000ac7

Please sign in to comment.