Open Bug 1417338 Opened 7 years ago Updated 2 years ago

fetch sets wrong Content-Type header on redirects

Categories

(Core :: DOM: Core & HTML, defect, P3)

58 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: tozz, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached 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".
Summary: fetch sends empty form data on redirect → fetch sets wrong Content-Type headeron redirects
Summary: fetch sets wrong Content-Type headeron redirects → fetch sets wrong Content-Type header on redirects
Component: Untriaged → DOM
Product: Firefox → Core
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
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: