-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
[Feature request] Support (nested) objects in formData #68
Comments
Hi @itsgoingd,
Indeed, thanks for the suggestion!
Actually there are some hidden subtlties, so I took the liberty of implementing the feature (which is now done and published in Here is the updated documentation. I kept the current behaviour as the default because a common use of I hope this change will suit your needs! |
Hey, thanks for including this! Found a small issue - combination of null values and nesting, eg. Looks like this check will need special handling of nulls, since https://github.com/elbywan/wretch/blob/master/src/wretcher.ts#L329-L335 |
Woops indeed! I just published a new release with the fix (v Thanks, good catch 👍! |
Works great, thanks again. |
The
formData
method can already handle arrays as seen here:https://github.com/elbywan/wretch/blob/master/src/wretcher.ts#L312-L324
But many server-side languages like PHP or Rails also support objects and even nested data, eg.
{ 'foo[bar]': 123, 'foo[baz][bar]': 456 }
.It would be very helpful if wretch supported this, should be an easy change to the
convertFormData
method above.I'm down to work on a PR if you agree on this feature.
The text was updated successfully, but these errors were encountered: