-
Notifications
You must be signed in to change notification settings - Fork 579
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
fix: handle missing vary header values #4031
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: SukkaW <[email protected]>
for (const key of Object.keys(opts.headers)) { | ||
headers[key.toLowerCase()] = opts.headers[key] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't do this, we lose case insensitivity in the cache unfortunately and the unit test fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? I thought headers name were already lowercased elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keys in the cache are lowercase but opts.headers keys are not
In the last request of the unit test we pass Accept-Encoding and it's value in the opts object is still Accept-Encoding, so the cache thinks the third request still doesn't have an accept-encoding property and uses the stored value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the response headers are already lowercased once parsed, but we do not handle the ones passed by the call to dispatch
; those can be potentially upper cased
for (const key of Object.keys(opts.headers)) { | ||
headers[key.toLowerCase()] = opts.headers[key] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? I thought headers name were already lowercased elsewhere?
Co-authored-by: Matteo Collina <[email protected]>
Co-authored-by: Matteo Collina <[email protected]>
for (const key of Object.keys(opts.headers)) { | ||
headers[key.toLowerCase()] = opts.headers[key] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the response headers are already lowercased once parsed, but we do not handle the ones passed by the call to dispatch
; those can be potentially upper cased
fixes: #3959