mirror of
https://github.com/tenrok/axios.git
synced 2026-06-11 18:02:32 +03:00
Fixing issue 2195 - order of if/else blocks is causing unit tests mocking XHR. (#2201)
This commit is contained in:
committed by
Felipe Martins
parent
c454e9f526
commit
1b07fb9365
+4
-5
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user