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: Accept object form in constructor #387

Closed
silverwind opened this issue Mar 1, 2024 · 1 comment
Closed

FormData: Accept object form in constructor #387

silverwind opened this issue Mar 1, 2024 · 1 comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@silverwind
Copy link

silverwind commented Mar 1, 2024

What problem are you trying to solve?

The FormData constructor is unergonomic to use for manual construction:

const fd = new FormData();
fd.append("name", name);
fd.append("file", file);

It would be nice if it accepts a object form:

const fd = new FormData({name, file)});

What solutions exist today?

URLSearchParams() is a similar interface that gained support for object form in its constructor.

How would you solve it?

Extend the standard.

Anything else?

One drawback is that the filename argument to append can not be provided in object form, but I think it's a non-issue because users can easily generate named File objects from Blob.

@silverwind silverwind added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Mar 1, 2024
@annevk
Copy link
Member

annevk commented Mar 1, 2024

Thank you, but this has already been reported as #202. Marking as a duplicate therefore.

@annevk annevk closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

2 participants