From c8c39c98c24da5e8df0fc3cbe184b3d593115b6f Mon Sep 17 00:00:00 2001 From: Jake Champion Date: Tue, 18 Jul 2023 01:52:17 +0100 Subject: [PATCH] Fix https://github.com/JakeChampion/fetch/issues/1076 --- fetch.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fetch.js b/fetch.js index c70622cf..d33d6a47 100644 --- a/fetch.js +++ b/fetch.js @@ -599,6 +599,11 @@ export function fetch(input, init) { Object.getOwnPropertyNames(init.headers).forEach(function(name) { xhr.setRequestHeader(name, normalizeValue(init.headers[name])) }) + request.headers.forEach(function(value, name) { + if (!Object.prototype.hasOwnProperty.call(init.headers, normalizeName(name))) { + xhr.setRequestHeader(name, value) + } + }) } else { request.headers.forEach(function(value, name) { xhr.setRequestHeader(name, value)