-
Notifications
You must be signed in to change notification settings - Fork 358
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
Multipart form request with fields of the same name only retains one field value #277
Comments
…art request Converted the fields Map to List of MapEntry objects
Closing as a duplicate of #24 |
@natebosch that one is for headers. This one is for fields. Would be nice to get some feedback on the PR. |
Does it work to do something like: var request = http.MultipartRequest('POST', dummyUrl);
request.fields['field1[0]'] = 'value1';
request.fields['field1[1]'] = 'value2'; |
Any alternative solution? |
I know that this is an old issue, but @natebosch suggestion will not work for all cases if the server implementation doesn't handle the bracket notation as they will be treated as different keys. And even for those server implementations that support the above, it still will be limited because you'll have to always provide an array index. In my opinion tagging the http package with v1.0.0 wasn't well thought out, because currently unless the |
I really feel bad about this event there are a lot of issues related to the same problem but not solved until now. using |
With Multipart form data, it is allowed to have multiple fields of the same name with different values and they all are submitted to the server.
A curl example of that is below (from Mailgun API documentation):
Here is the test case:
The above test case fails because we store fields in a Map and so
value2
replaces the previously setvalue1
forfield1
.The text was updated successfully, but these errors were encountered: