Closed
Bug 1143857
Opened 10 years ago
Closed 10 years ago
Fetch does not serialize FormData body; breaks GitHub.
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla39
Tracking | Status | |
---|---|---|
firefox39 | --- | fixed |
People
(Reporter: callahad, Assigned: nsm)
References
Details
Attachments
(1 file, 1 obsolete file)
39 bytes,
text/x-review-board-request
|
Details |
FormData bodies are incorrectly serialized when using fetch().
When I make this request:
var data = new FormData();
data.append('foo', 'bar');
fetch('', { method: 'post', body: data });
I see a serialized body of "[object FormData]", which is not usable.
This is also incorrect per https://fetch.spec.whatwg.org/#body-mixin
This completely breaks all file uploads on GitHub.
(e.g., attaching images to issues or changing avatars)
Firefox 38 (Aurora) falls back to GitHub's polyfill and works great.
Firefox 39 (Nightly) defines fetch(), skips the polyfill, and is unusable.
Updated•10 years ago
|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Reporter | ||
Comment 2•10 years ago
|
||
Reopening per https://bugzilla.mozilla.org/show_bug.cgi?id=1109751#c11
This bug is for serializing and sending FormData, bug 1109751 is for the .formData() body consuming method.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Assignee | ||
Comment 3•10 years ago
|
||
/r/5537 - Bug 1143857 - Add FormData serialize support to Fetch API.
Pull down this commit:
hg pull review -r 34ac3e964055d87c5bd35a3442b23d3fbe5f393e
Attachment #8578712 -
Flags: review?(ehsan)
Assignee | ||
Comment 4•10 years ago
|
||
FYI, the test for the send is the same as the test for xhr https://hg.mozilla.org/integration/mozilla-inbound/file/24cf8a18a1a3/dom/html/test/formData_test.js#l108 except the indices are bumped since i added a string at the first position of the FormData
Comment 5•10 years ago
|
||
Comment on attachment 8578712 [details]
MozReview Request: bz://1143857/nsm
https://reviewboard.mozilla.org/r/5535/#review4513
::: dom/fetch/moz.build
(Diff revision 1)
> + '../base',
Can you please export the headers that you need instead?
::: dom/tests/mochitest/fetch/worker_test_fetch_basic_http.js
(Diff revision 1)
> +function testFormDataSend() {
Please add a comment indicating where this is copied from.
::: dom/tests/mochitest/fetch/worker_test_fetch_basic_http.js
(Diff revision 1)
> +function testFormDataRead() {
What's up with this empty function?
::: dom/workers/test/fetch/worker_test_request.js
(Diff revision 1)
> -function testBodyCreation() {
Why this change?
Attachment #8578712 -
Flags: review?(ehsan)
Assignee | ||
Comment 6•10 years ago
|
||
From IRC:
<nsm> ehsan: yes it makes sense. so i took the patch from 1109751 and split it up. and in interactive committing it was easier to leave the empty function in this patch and also make the greek string global. if you want i can put it in the right patch
<ehsan> nsm: please do, if possible, if it's too much of a hassle don't worry about it
I think i'll make the change and land.
Assignee | ||
Comment 8•10 years ago
|
||
Comment on attachment 8578712 [details]
MozReview Request: bz://1143857/nsm
/r/5537 - Bug 1143857 - Add FormData serialize support to Fetch API.
Pull down this commit:
hg pull review -r fffc4114c45e775c6148730734f562922a151d7d
Attachment #8578712 -
Flags: review?(ehsan)
Assignee | ||
Comment 9•10 years ago
|
||
Comment on attachment 8578712 [details]
MozReview Request: bz://1143857/nsm
Dropping review since ehsan r+ed it and I've made the suggested changes.
Attachment #8578712 -
Flags: review?(ehsan)
Assignee | ||
Comment 10•10 years ago
|
||
Assignee | ||
Comment 11•10 years ago
|
||
Comment 12•10 years ago
|
||
Assignee: nobody → nsm.nikhil
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Assignee | ||
Comment 13•9 years ago
|
||
Attachment #8578712 -
Attachment is obsolete: true
Assignee | ||
Comment 14•9 years ago
|
||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•