Skip to content

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

@en30

Description

@en30

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions