2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

Moving default adapter to global defaults

This commit is contained in:
Rubén Norte
2016-07-10 18:01:40 +02:00
parent 755a9b3459
commit b2745873a1
2 changed files with 34 additions and 34 deletions
+14
View File
@@ -14,7 +14,21 @@ function setContentTypeIfUnset(headers, value) {
}
}
function getDefaultAdapter() {
var adapter;
if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
adapter = require('./adapters/xhr');
} else if (typeof process !== 'undefined') {
// For node use HTTP adapter
adapter = require('./adapters/http');
}
return adapter;
}
module.exports = {
adapter: getDefaultAdapter(),
transformRequest: [function transformRequest(data, headers) {
normalizeHeaderName(headers, 'Content-Type');
if (utils.isFormData(data) ||