mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
Axios create url bug (#2290)
* Fix #2234 * added spacing --eslint * added test cases * removed unexpected cases after updating the code
This commit is contained in:
@@ -34,7 +34,7 @@ module.exports = function mergeConfig(config1, config2) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
utils.forEach([
|
utils.forEach([
|
||||||
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
||||||
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
||||||
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
|
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
|
||||||
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
|
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
|
||||||
|
|||||||
@@ -32,13 +32,11 @@ describe('core::mergeConfig', function() {
|
|||||||
|
|
||||||
it('should not inherit request options', function() {
|
it('should not inherit request options', function() {
|
||||||
var localDefaults = {
|
var localDefaults = {
|
||||||
url: '__sample url__',
|
|
||||||
method: '__sample method__',
|
method: '__sample method__',
|
||||||
params: '__sample params__',
|
params: '__sample params__',
|
||||||
data: { foo: true }
|
data: { foo: true }
|
||||||
};
|
};
|
||||||
var merged = mergeConfig(localDefaults, {});
|
var merged = mergeConfig(localDefaults, {});
|
||||||
expect(merged.url).toEqual(undefined);
|
|
||||||
expect(merged.method).toEqual(undefined);
|
expect(merged.method).toEqual(undefined);
|
||||||
expect(merged.params).toEqual(undefined);
|
expect(merged.params).toEqual(undefined);
|
||||||
expect(merged.data).toEqual(undefined);
|
expect(merged.data).toEqual(undefined);
|
||||||
|
|||||||
@@ -37,6 +37,19 @@ describe('instance', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should make an http request with url instead of baseURL', function () {
|
||||||
|
var instance = axios.create({
|
||||||
|
url: 'https://api.example.com'
|
||||||
|
});
|
||||||
|
|
||||||
|
instance('/foo');
|
||||||
|
|
||||||
|
getAjaxRequest().then(function (request) {
|
||||||
|
expect(request.url).toBe('/foo');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should make an http request', function (done) {
|
it('should make an http request', function (done) {
|
||||||
var instance = axios.create();
|
var instance = axios.create();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user