Skip to content

Commit

Permalink
Merge pull request #930 from luciy/master
Browse files Browse the repository at this point in the history
Convert the method parameter to lowercase
  • Loading branch information
nickuraltsev committed Jun 1, 2017
2 parents d1278df + e4e3212 commit 3579da4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit 3579da4

Please sign in to comment.