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

Convert the method parameter to lowercase #930

Merged
merged 1 commit into from Jun 1, 2017
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
1 change: 1 addition & 0 deletions lib/core/Axios.js
Expand Up @@ -35,6 +35,7 @@ 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)) {
Expand Down
16 changes: 16 additions & 0 deletions test/specs/requests.spec.js
Expand Up @@ -17,6 +17,22 @@ describe('requests', function () {
});
});

it('should treat method value as lowercase string', function (done) {
axios({
url: '/foo',
method: 'POST'
}).then(function (response) {
expect(response.config.method).toBe('post');
done();
});

getAjaxRequest().then(function (request) {
request.respondWith({
status: 200
});
});
});

it('should allow string arg as url, and config arg', function (done) {
axios.post('/foo');

Expand Down