fix(req.get): perform case-insensitive header lookup - #7395
Open
armanmikoyan wants to merge 1 commit into
Open
Conversation
Contributor
|
I won't close this yet, but in my opinion #5288 is the result of modifying Node.js API object in a way that violates requirements/assumptions stated in documentation and Express should not work around problems in code that uses it. |
Member
|
I'm adding it as an idea for Express 6. It doesn't mean it'll be included—it's just something for us to discuss. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5288
This updates
req.get()/req.header()to perform a case-insensitive lookup when a header is present under a non-lowercase key.Previously, custom headers added directly to
req.headerswith mixed-case names, such asX-filipe, could not be read withreq.get('x-filipe'). This change preserves the fast direct lookup path, then falls back to scanning header keys case-insensitively.After this change, the same lookup returns the header value:
A regression test was added for custom mixed-case request headers.