Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch with Request init with body of FormData is broken #10002

Closed
johnspurlock opened this issue Apr 4, 2021 · 0 comments · Fixed by #10203
Closed

fetch with Request init with body of FormData is broken #10002

johnspurlock opened this issue Apr 4, 2021 · 0 comments · Fixed by #10203
Labels
bug Something isn't working correctly ext/fetch related to the ext/fetch

Comments

@johnspurlock
Copy link
Contributor

johnspurlock commented Apr 4, 2021

FormData set as the body: BodyInit of the RequestInit passed to the Request constructor should behave the same way as the body: BodyInit of the RequestInit as the second arg to fetch(input, init)

Currently it doesn't, sending a request body with the text [object FormData]

const formData = new FormData();
formData.append('foo', 'bar');
const res = await fetch(new Request('http://example.com', { method: 'POST', body: formData }));
// request.text() on the server side will be "[object FormData]", request.formData() will be empty

deno 1.8.2 (release, x86_64-apple-darwin)
v8 9.0.257.3
typescript 4.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly ext/fetch related to the ext/fetch
Projects
None yet
2 participants