headers are all set to lowercase
Describe the Bug
i am trying to make a HTTP POST request to an API with a specific header set, but the header gets set to all lowercase at some point
Steps to Reproduce
- create code that makes a HTTP request, ie
Request::post("/auth/login")
.header("TEstHeadEr", "MyVAlUe")
.send()
.await;
- send it
- open browser console
- open request you just sent
- there should be a header named
testheader: MyVAlUe(note the diffrence in case)
Expected Behavior
header set should match the case of whats defined in the code.
Actual Behavior
header is always lowercase, regardless of code
Additional Context
tested on chromium and firefox; same thing
Http header are case insensitive https://stackoverflow.com/a/5259004 So this should not be an issue IMO.
it doesn't matter. you cant grantee the server your communicating with is also going to be case insensitive
Can you confirm that fetch also does that? Gloo exposes the Headers interface and does no pre-processing
it doesn't matter. you cant grantee the server your communicating with is also going to be case insensitive
If the server isn't compliant with the spec then you don't have any guarantees at all. If you have a bug where this is an issue, then this ticket belongs with the server, not here.
Compliance aside, I do agree with the spirit of keeping the case as specified.
If you use HTTP 2.0, the browser will turn all headers to lowercase. This is enforced by your browser and cannot be worked around.
However, header field names MUST be converted to lowercase prior to their encoding in HTTP/2. A request or response containing uppercase header field names MUST be treated as malformed
See: https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2