-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: cache raw cookie value and decode when getting #13485
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
Conversation
🦋 Changeset detectedLatest commit: c3929be The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #13485 will not alter performanceComparing Summary
|
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.
Can we add a test to avoid possible future regressions?
| return !!values[key]; | ||
| const values = this.#ensureParsed(); | ||
| return values[key] !== undefined; |
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.
Previously it would return false for has() when the cookie had a falsy value, even if it existed
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.
Thank you!
Changes
Currently, when a cookie is first parsed from the header the value is cached. This means that if subsequent requests pass a different decode function it will be ignored. This PR changes the behaviour to cache the raw cookie values, and then decode them when getting them. This means the passed decode function will always be used.
Fixes #13078
Testing
Docs