From ac590a3877a7f35d59bf35e6e3e16adba65f1732 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fetch.js b/fetch.js index c70622cf..9088c484 100644 --- a/fetch.js +++ b/fetch.js @@ -596,9 +596,16 @@ export function fetch(input, init) { } if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) { + var names = []; Object.getOwnPropertyNames(init.headers).forEach(function(name) { + names.push(normalizeName(name)) xhr.setRequestHeader(name, normalizeValue(init.headers[name])) }) + request.headers.forEach(function(value, name) { + if (names.indexOf(name) === -1) { + xhr.setRequestHeader(name, value) + } + }) } else { request.headers.forEach(function(value, name) { xhr.setRequestHeader(name, value)