Skip to content
This repository

Check for Host header should be case-insensitive #406

avik-das opened this Issue · 3 comments

3 participants

Avik Das Jeremy Spilman Mikeal Rogers
Avik Das

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.

Jeremy Spilman

See also #411

Mikeal Rogers

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.

Avik Das

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.