-
Notifications
You must be signed in to change notification settings - Fork 17
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
Mysterious header "content-type" => "application/json" being added #52
Comments
It seems to have something to do with the 2.2 update. I wrote the code a while ago before I update the dependency and I worked well. |
@jackalcooper The maxwell are keeping headers in their lower case format internally to dismiss the need to handle headers with different format. @zhongwencool I think we should downcase the header names user passed in to |
There are cases in which the back end is not that tolerant about it. For instance Rails allow the existence of both upper and down cases while Phoenix doesn't. I got this problem with Elm's HTTP library before as well. |
This is so tricky. I cleared up a module which used Httpoison and the extra header disappeared |
@jackalcooper Definitely, the HTTP protocol requires HTTP servers to handle header names in a case-insensitive manner. Rails keep headers in an environment variable format, while phoenix use plug internally, and plug keeps header in a lower case format. So both of them support both upper and down case. The different is in Rails you can query a header in any format because it makes the converting at the query time, and in Phoenix, you should use the lower case header name. |
You should be case-insensitive but, in general, case-respecting. Downcase when you do comparisons, but it's annoying that an adapter is monkeying with the data while passing it though. I just started using Maxwell and this has already bitten me. |
@ijcd We did implement a version that tries to keep the case of header names user passed in while keeping a case-insensitive format internally with something like But knowing all the adapted clients use downcase headers internally, we stop bothering ourselves to keep a user-specified case. Users can use So could you be more specific about the scenario that you are bitten? |
In my case I had a few hundred tests that I moved over from HTTPotion. The headers being downcased caused me to have to edit many of them. I worked it out, but it's annoying. If the server won't care about the case, I want the driver to send what I ask it to, or at least have an option to do so. It shouldn't have opinions about this (the protocol doesn't). |
@ijcd Actually the HTTPotion use The thing the Matching headers with unified case( downcased in our case) would be much easier than matching headers with mixed case. And the changes you made to your test cases definitely improved their robustness:). So we will just leave it the way it is. |
There should not be a
"content-type" => "application/json
because that's myMaxwell.Middleware.Headers
's paramsThe text was updated successfully, but these errors were encountered: