-
Notifications
You must be signed in to change notification settings - Fork 66
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
Issue with Content Type #148
Comments
@OskarEichler |
@0x1eef Thanks for looking into this - here is how we send the request:
Also note that we had to create custom methods Here is our CaseSensitiveGet class for context:
|
We've identified an issue in the current release of net-http (0.3.2).
When setting a 'Content-Type' header on a POST request like so:
request['Content-Type'] = 'application/json'
It does set the header, however, it does not recognize that the Content-Type is set correctly and adds an additional header to the request with the default
application/x-www-form-urlencoded
This can be seen when calling: request.to_hash.inspect:
The only way to force the application/json header to go through is to explicitly set it in the request:
request.content_type = 'application/json'
So actually it needs to be set twice in order to fully work:
Also when setting
request['content-type'] = 'application/json'
in lower case it's throwing the error:It would be great if this can be streamlined so that setting the content-type in the headers immediately propagates across the entire request, without the need to set it multiple times or be cautious of case sensitivity. This took us a couple of hours to debug because we were un-aware that it currently sends the same header twice in the same request with different values.
The text was updated successfully, but these errors were encountered: