-
-
Notifications
You must be signed in to change notification settings - Fork 682
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
JSON array directly in request body is interpreted as Object #850
Comments
Try again with version 3 |
I cannot use v3:
I use
|
Don't use webpack |
How is this a solution to this problem? |
@Akxe use v3, and probably something like that with const req = require('esm')(module);
const formidable = req('formidable'); |
Aside from the other comment with possible temporary solution. Well, i think it's because when there's only one it's an json, when there are multiple it's an array. I don't like that change in behaviors too, but.. i don't like single item arrays either. uh, wait a sec, why is that aaand, what you mean with that title, i still don't get it. Is |
@tunnckoCore It was meant to be |
@Akxe well, i'm really struggling to understand all that. I looked at the code and yea, |
Hey, the point is that if you pass an array to body of normal requests the BodyParser will give an array in the NodeJS part, but if you pass the same array to the FormData, it will be transformed to an object. It actually fought me off guard, since I had to switch from body request to formData (because I wanted to send a file); The array function I expected to be present was suddenly not present even though there was no indication that it should not. TLDR; For consistency's sake, it should mimic BodyParser/JSON.stringify as close as possible. |
can you give actual example and data. |
Support plan
Context
What are you trying to achieve or the steps to reproduce?
What was the result you got?
The result of
form.parse
is anObject
notArray
What result did you expect?
The result of
form.parse
should be anArray
.The text was updated successfully, but these errors were encountered: