Skip to content

Easier way to work with FormData  #3721

@carpben

Description

@carpben

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions