JakeChampion/fetch

Content-Type inferred from body is overridden if headers are given as object

en30 opened this issue · 0 comments

en30 commented

Actual Behaviour

When fetch as below,

fetch("/foo", {
 method: "POST",
 headers: {
   "Accept": "text/html"
 },
 body: new URLSearchParams("bar=1")
})

the request's Content-Type header value is text/plain;charset=UTF-8 since #798.

Expected behavior

The request's Content-Type header value is application/x-www-form-urlencoded;charset=UTF-8.