Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axios create url bug #2290

Merged
merged 5 commits into from Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core/mergeConfig.js
Expand Up @@ -34,7 +34,7 @@ module.exports = function mergeConfig(config1, config2) {
});

utils.forEach([
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
Expand Down
2 changes: 0 additions & 2 deletions test/specs/core/mergeConfig.spec.js
Expand Up @@ -32,13 +32,11 @@ describe('core::mergeConfig', function() {

it('should not inherit request options', function() {
var localDefaults = {
url: '__sample url__',
method: '__sample method__',
params: '__sample params__',
data: { foo: true }
};
var merged = mergeConfig(localDefaults, {});
expect(merged.url).toEqual(undefined);
expect(merged.method).toEqual(undefined);
expect(merged.params).toEqual(undefined);
expect(merged.data).toEqual(undefined);
Expand Down
13 changes: 13 additions & 0 deletions test/specs/instance.spec.js
Expand Up @@ -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) {
var instance = axios.create();

Expand Down