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

feat: Support FormData object entries parsing #15

Merged
merged 1 commit into from
Nov 9, 2022
Merged

feat: Support FormData object entries parsing #15

merged 1 commit into from
Nov 9, 2022

Conversation

mdoury
Copy link
Contributor

@mdoury mdoury commented Nov 7, 2022

Here is a solution to support object entries in FormData which enables <input type="file" /> parsing.

FormData object entries are stringified before FormData is parsed using the URLSearchParams trick.

FormData object entries are not parsed by the default parser, making it rather versatile as it enables users to parse object entries of any type using a custom parser.

I had to make some typings generic in order to support custom parsed search params types.

Fixes #14.

@rileytomasek
Copy link
Owner

Thank you! Looks good from a quick read — I'll do a proper review and merge+release tomorrow because I assume you need this for your project.

@mdoury
Copy link
Contributor Author

mdoury commented Nov 8, 2022

Thank you, that'd be great!

@rileytomasek rileytomasek merged commit eb255fd into rileytomasek:master Nov 9, 2022
@rileytomasek
Copy link
Owner

Thanks again for adding this, @mdoury. I just published it as v0.3.1.

@mdoury
Copy link
Contributor Author

mdoury commented Nov 9, 2022

You're welcome @rileytomasek. I'd be happy to help more if you want.

@rileytomasek
Copy link
Owner

Thanks @mdoury. Let me know if you have any ideas, but I'd like to keep Zodix as lean as possible, and prevent it from evolving into another of the many bloated form libraries.

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.

Unable to parse file uploads handled with unstable_createFileUploadHandler
2 participants