Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

headers converted to lowercase #63

Open
spiderworm opened this issue Jul 20, 2017 · 6 comments
Open

headers converted to lowercase #63

spiderworm opened this issue Jul 20, 2017 · 6 comments

Comments

@spiderworm
Copy link

I've noticed that adding headers to requests using request-json clientside (perhaps via node as well) causes the headers name to be converted to lowercase, i.e. adding the following header:

{ Authorization: Bearer ${token} }

... results in the following header:

authorization: Bearer ${token}

Not sure if this is an issue with services, but it's disconcerting that request-json appears to be modifying my headers.

@frankrousseau
Copy link
Contributor

Thank you @spiderworm for reporting. I will look for good practice, then I will fix this if needed.

@ethzero
Copy link

ethzero commented Aug 6, 2017

Hi there,
I'm going to add a 'me too' in that I found that the following GET url fails:
https://www.edsm.net/api-commander-v1/get-ranks?commanderName=ethzero

Because of the same forcing-of-lowercase issue I believe.

https://www.edsm.net/api-commander-v1/get-ranks?commandername=ethzero

@frankrousseau
Copy link
Contributor

It looks to be more related to the Node.js platform. I will dig into it to see if some options can be set to remove this automatic lowercase transforming.

@frankrousseau
Copy link
Contributor

But FYI, servers should not be case sensitive when dealing with headers.

@frankrousseau
Copy link
Contributor

I made some research. Unfortunately, Node.js low-level client lower-case every headers keys. It cannot be fixed without complex development.

https://nodejs.org/api/http.html#http_message_headers

@spiderworm
Copy link
Author

In my situation, the lower-case headers did not cause an issue on the server. The real issue I had was caused by Chrome's Developer Tools, which has trouble showing POST data apparently when the header is 'content-type' rather than 'Content-Type', so this is something that Google can fix. Regardless, I do hope Node changes this behavior at some point, because I still do not think that it should be mucking around with the header names I provide.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants