-
Notifications
You must be signed in to change notification settings - Fork 435
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
Unable to override Content-Type header #630
Comments
i was able ot reproduce the issue : we should allow the user to have a total control over the content type . I will look into it and see how we can solve this |
@ashitaprasad should we also allow the user to choose the encoding ? |
@AffanShaikhsurab Are you working on this issue ? I wanted to work on this if needed can both work together? |
Hi @Jaishree2310, I've already created a pull request (#631) to address this issue. However, if you have any suggestions or improvements, feel free to review the PR and share your thoughts. I'd be happy to collaborate or make any necessary refinements. |
@AffanShaikhsurab The default encoding should be utf-8, if the user specifies a particular encoding using header field |
@ashitaprasad Thanks for clarifying , the current implementation in the pr satisfies the above functionality |
No @AffanShaikhsurab it doesn't. The Request header for |
@ashitaprasad Apologies for the oversight! I've updated it to support multiple encoding types. If you have any further suggestions, I'd be happy to implement them! |
Describe the bug/problem
Create a new POST request as shown below with JSON body
If you do not specify any content-type in header, the client automatically sets it to
application/json; charset=utf-8
.In the headers, you can specify the
Content-Type
asapplication/json
to override the default and send request. When you inspect headers in response pane you can observe that the Request header that was sent forContent-Type
wasapplication/json; charset=utf-8
instead ofapplication/json
`charset=utf-8' is automatically added into 'Content-Type', and we are unable to remove it as for some APIs, this header string can cause rejection.
Similarly, if you set
text/csv
as Content-Type in Request and send the response. Againcharset=utf-8' is being automatically added by
http` library.The objective is that user should have full control over the
Content-Type
header that is being sent to the server.Relevant issues:
charset
toContent-Type
header dart-lang/http#1438The text was updated successfully, but these errors were encountered: