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

fix: use spec'ed formdata #958

Merged
merged 1 commit into from Dec 27, 2022
Merged

Conversation

jimmywarting
Copy link
Contributor

This PR remove the dependency of form-data package

FormData exists built in to NodeJS now in v18+ now.
Both got and node-fetch support encoding a spec'ed FormData themself now, and the form-data package is now considered as legacy by node-fetch and gots standards. form-data haven't been updated for a long while and it lacks many methods and don't really follow the specification.

node-fetch ships with a polyfilled FormData and ways to get Blob/File like objects backed up by the filesystem that is read lazily when needed (thanks to the fetch-blob package). The native FormData provided by NodeJS themself do also support Blob / File like objects and dosen't need to be strictly the same instances of globalThis.Blob so node-fetch can now also export the native FormData when it's available.


This might be a little bit of topic but i think you should strive towards eventually being able to replace node-fetch and got with built in features provided by NodeJS themself to have fewer dependencies. a long term goal and a granular replacement would be to:

  • Switch out got for node-fetch
  • Switch out node-fetch for Undici when dropping support for NodeJS v16.8
  • Switch out Undici for built in Fetch when dropping support for NodeJS v18
  • Switch out fetch-blob/from.js for native fn when NodeJS adds a feature to get blob/files backed up by the file system

@webpro webpro merged commit c21e6b6 into release-it:master Dec 27, 2022
@webpro
Copy link
Collaborator

webpro commented Dec 27, 2022

Thanks @jimmywarting, it's in v15.6.0.

Totally agree with your suggestions, will keep it in mind.

@jimmywarting jimmywarting deleted the change-formdata branch December 27, 2022 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants