Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When checking headers specified in Vary, the header names should be checked with a fallback to downcasing #136

Closed
evman182 opened this issue Jan 13, 2024 · 2 comments

Comments

@evman182
Copy link
Contributor

For the following line:

request.headers[header] == cached_request[:headers][header]

my suggestion is it be changed to

 request.headers[header] == (cached_request[:headers][header] || cached_request[:headers][header.downcase])

This is based on the fact that rack and Faraday Header classes both seem to downcase the keys
https://github.com/rack/rack/blob/3897649e8740e560a5fa142f972121a119b26b5c/lib/rack/headers.rb#L110-L116

https://github.com/lostisland/faraday/blob/cc5d60776645d3d341ff0f425c45b3b3d48d98e0/lib/faraday/utils/headers.rb#L52-L63

@georgeguimaraes
Copy link
Member

Hi @evman182! Tks for the suggestion, it makes a lot of sense.
Would you mind sending a PR? Not sure if we have tests covering this part, but a test on this logic would be awesome too.

@georgeguimaraes
Copy link
Member

#137

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

No branches or pull requests

2 participants