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

FormData #930

Closed
ronag opened this issue Aug 5, 2021 · 9 comments · Fixed by #1099
Closed

FormData #930

ronag opened this issue Aug 5, 2021 · 9 comments · Fixed by #1099
Labels
enhancement New feature or request fetch
Milestone

Comments

@ronag
Copy link
Member

ronag commented Aug 5, 2021

Support for form data in fetch.

Do we know of any spec compliant implementation that we can re-use?

@ronag ronag added enhancement New feature or request fetch labels Aug 5, 2021
@ronag ronag mentioned this issue Aug 5, 2021
39 tasks
@Ethan-Arrowood
Copy link
Collaborator

This is the library node-fetch uses: https://github.com/form-data/form-data

@Ethan-Arrowood
Copy link
Collaborator

There is also this on going discussion for form-data in node core: nodejs/node#38943

@szmarczak
Copy link
Member

@Ethan-Arrowood That library uses combined-stream which is not maintained anymore has lots of bugs and we have problems with it in Got :(

@szmarczak
Copy link
Member

Maybe @octet-stream would be interested in this. Relevant: sindresorhus/got#1810

@octet-stream
Copy link
Contributor

octet-stream commented Aug 5, 2021

There's at least two spec-compliant implementations for Node.js: formdata-node which has some additional APIs that are not spec-compliant, but I'm planning to get rid of them in the next major release around Node.js 12 EOL, and we also have formdata-polyfill

I also have made an encoder that can be used for multipart/form-data serialization: form-data-encoder

@octet-stream
Copy link
Contributor

octet-stream commented Aug 5, 2021

By the way, node-fetch has a plan to remove support of form-data package. See: node-fetch/node-fetch#1167

@joshxyzhimself
Copy link
Contributor

Not sure if spec compliant, but we've got great results with https://www.npmjs.com/package/multi-part.

We have used it with both got and undici.

@szmarczak
Copy link
Member

unmaintained :(

@ronag
Copy link
Member Author

ronag commented Aug 14, 2021

Doesn't look too difficult to implement ourselves both FormData and File look rather trivial. @Ethan-Arrowood or @szmarczak would you be interested to have a go at it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fetch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants