Check for Host header should be case-insensitive #406

avik-das opened this Issue Jan 4, 2013 · 5 comments

3 participants


Currently, request checks that if the 'Host' header is present in the options but only checks the lowercase version:

What I see is that I can't set the 'Host' header with capitalization because it is ultimately overwritten by 'host'. I would like to, for the sake of agreement with standard protocol , set 'Host' instead of 'host', but I'm unable to. Can the check on the line I linked to be made case-insensitive? I can provide a patch if necessary.

Ideally, I'd love for the header that request sets itself to also be capitalized so that I don't have to override the capitalization, but at least the check should be case-insensitive.


See also #411

request member

we need either a getHeader or headerExists method that is caseless. I think the ideal API is

r.getHeader('HoSt') // returns value or undefined

If you want to find the casing yourself you can just iterate over the headers object.


I see getHeader on line 815 already (though it also takes as input the headers object), so the check for 'Host' should be using that as far as I can tell.

request member


@mikeal mikeal closed this Aug 27, 2014

Thanks @mikeal !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment