From cbda78552b48bed68a014b1b1bfdf8bd6cd79ec3 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 22 May 2020 21:44:26 +0200 Subject: [PATCH] Revert "Bug/allow header to contain http verb keys #1252 (#1258)" (#2977) This reverts commit 920510b3a6fecdeb2ba2eb472b0de77ec3cbdd06. --- lib/core/dispatchRequest.js | 4 +--- test/specs/headers.spec.js | 13 ------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/core/dispatchRequest.js b/lib/core/dispatchRequest.js index 7768e00..c8267ad 100644 --- a/lib/core/dispatchRequest.js +++ b/lib/core/dispatchRequest.js @@ -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]; } ); diff --git a/test/specs/headers.spec.js b/test/specs/headers.spec.js index 6c2aba3..5a8b1a8 100644 --- a/test/specs/headers.spec.js +++ b/test/specs/headers.spec.js @@ -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(); - }); - }); - }); });