Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Revert "Bug/allow header to contain http verb keys axios#1252 (axios#…
Browse files Browse the repository at this point in the history
…1258)" (axios#2977)

This reverts commit 920510b.
  • Loading branch information
jasonsaayman authored and gwdp committed Jul 17, 2020
1 parent a50ee4d commit cd3142c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
4 changes: 1 addition & 3 deletions lib/core/dispatchRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ module.exports = function dispatchRequest(config) {
utils.forEach(
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
function cleanHeaderConfig(method) {
if (typeof config.headers[method] !== 'string') {
delete config.headers[method];
}
delete config.headers[method];
}
);

Expand Down
13 changes: 0 additions & 13 deletions test/specs/headers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,4 @@ describe('headers', function () {
done();
});
});

describe('when a header key matches an HTTP verb', function() {
it('preserves the header value', function(done) {
axios.post('/foo', null, { 'headers': { 'delete': 'test' } });

getAjaxRequest().then(function (request) {
var headerValue = request.requestHeaders['delete'];

expect(headerValue).toEqual('test');
done();
});
});
});
});

0 comments on commit cd3142c

Please sign in to comment.