http post a map object using application/json content-type #17636
Labels
area-pkg
Used for miscellaneous pkg/ packages not associated with specific area- teams.
closed-not-planned
Closed as we don't intend to take action on the reported issue
This issue was originally filed by [email protected]
I am encountering a problem trying to use the "package:http/http.dart' pub package to post some JSON data to a web service. I have formatted the data correctly (which I confirmed by posting using the Advanced REST Client extension for Chrome) and the only difference is the Content-Type is forced to the wrong type (the web service only accepts "application/json"):
If body is a Map, it's encoded as form fields using encoding. The content-type of the request will be set to "application/x-www-form-urlencoded"; this cannot be overridden.
The documentation suggests:
For more fine-grained control over the request, use Request or StreamedRequest instead.
Why is the post content type limited to only form-urlencoded? Can the pub package be fixed to set the content type dynamically?
The text was updated successfully, but these errors were encountered: