Skip to content

Commit

Permalink
If headers are passed in via a Record then do not normalise the heade…
Browse files Browse the repository at this point in the history
…r names as part of the request
  • Loading branch information
JakeChampion committed Jul 10, 2020
1 parent 5ef028d commit b65ed60
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fetch.js
Expand Up @@ -547,9 +547,15 @@ export function fetch(input, init) {
}
}

request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
xhr.setRequestHeader(name, normalizeValue(init.headers[name]))
})
} else {
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
}

if (request.signal) {
request.signal.addEventListener('abort', abortXhr)
Expand Down

0 comments on commit b65ed60

Please sign in to comment.