gaxios
gaxios copied to clipboard
case sensitivity of headers should not matter
Currently if one were to set a "content-type" header and a "Content-Type" header, the two are not equivalent.
I've seen libraries like express
approach this differently, such that headers
are case-insensitive.
Headers are case-insensitive according to RFC2616 so this is a bug, not a feature request, in my opinion.
I'm not sure what the actual bug is here :) Can someone give me an example? Right now the request.Headers
field is just a POJO.
For example:
const options: GaxiosOptions = {
headers: {
'content-type': 'application/json',
'Content-Type': 'text/xml',
},
},
We could look for this situation and throw if we find duplicate keys once lower cased?
@JustinBeckwith a warning might be enough, but I think a cleaning step that lowercases headers would be good, that way upstream libraries that build on top of gaxios, e.g., google-auth-library need not check every combination of a given header.