-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Easier way to work with FormData #3721
Copy link
Copy link
Closed
Description
Is your feature request related to a problem? Please describe.
Yes.
When fetching and sending data as form data, the user is required to manually build a form data object.
- If the data is nested, building form data isn't trivial, and can result in an inappropriate structure and bugs.
- If the data already exists as an object or array, the user needs to write his own solution to convert an object to form data.
Describe the solution you'd like
Provide a reliable easy way to convert object to form data.
Describe alternatives you've considered
I couldn't find a simple existing solution to easily convert a nested object to form data.
Additional context
Since form data is only used (as far as I know) in the context of fetching, I thought Axios should provide this functionality. Perhaps export a function that can convert an object to form data, or add a property to AxiosConfig and handle the conversion internally.
If relevant I'd be happy to submit a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels