fetch sets wrong Content-Type header on redirects

UNCONFIRMED
Unassigned

Status

()

defect
P3
normal
UNCONFIRMED
a year ago
a month ago

People

(Reporter: tozz, Unassigned)

Tracking

(Blocks 1 bug)

58 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

6.80 KB, application/json
Details
862 bytes, application/zip
Details
(Reporter)

Description

a year ago
Posted file har.json
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:58.0) Gecko/20100101 Firefox/58.0
Build ID: 20171103003834

Steps to reproduce:

Create a fetch request that submits FormData to a backend that sends a 303 and a Location header.

fetch(url, {
  method: 'POST',
  credentials: 'same-origin',
  body: new FormData(document.getElementById('#form'))
})


Actual results:

The FormData is sent correctly to the server, the Location header is parsed and followed as a GET, but the Content-Type header gets set as "multipart/form-data".

HAR log of the two requests attached.


Expected results:

The GET should not have header Content-Type "multipart/form-data".
(Reporter)

Updated

a year ago
Summary: fetch sends empty form data on redirect → fetch sets wrong Content-Type headeron redirects
(Reporter)

Updated

a year ago
Summary: fetch sets wrong Content-Type headeron redirects → fetch sets wrong Content-Type header on redirects
Component: Untriaged → DOM
Product: Firefox → Core
(Reporter)

Comment 1

a year ago
This shows the behavior, surprisingly this also makes Chrome set the content-type on redirect but it doesn't do it on the site production code.
Priority: -- → P3
Component: DOM → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.