Skip to content

Commit

Permalink
Fix #1076
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeChampion committed Jul 18, 2023
1 parent e3375eb commit ac590a3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ac590a3

Please sign in to comment.