2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Fixing baseURL not working in interceptors (#950)

* Fixing baseURL not working in interceptors

* add test for  modify base URL in request interceptor
This commit is contained in:
Haven
2017-08-12 20:15:27 +08:00
committed by Rubén Norte
parent 6508280bbf
commit 2b8562694e
3 changed files with 25 additions and 7 deletions
-7
View File
@@ -4,8 +4,6 @@ var defaults = require('./../defaults');
var utils = require('./../utils');
var InterceptorManager = require('./InterceptorManager');
var dispatchRequest = require('./dispatchRequest');
var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
var combineURLs = require('./../helpers/combineURLs');
/**
* Create a new instance of Axios
@@ -37,11 +35,6 @@ Axios.prototype.request = function request(config) {
config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
config.method = config.method.toLowerCase();
// Support baseURL config
if (config.baseURL && !isAbsoluteURL(config.url)) {
config.url = combineURLs(config.baseURL, config.url);
}
// Hook up interceptors middleware
var chain = [dispatchRequest, undefined];
var promise = Promise.resolve(config);