-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(adapter-nextjs): duplicate response Set-Cookie headers in pages router #13765
Conversation
Array.isArray(existingSetCookieValues) && | ||
existingSetCookieValues.findIndex( | ||
cookieValue => | ||
cookieValue.startsWith(`${encodedName}=`) && |
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.
naive question: why not just check startsWith(`${encodedName}=${value};`)
here?
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.
As value may change when there were back to back token refreshes happened, e.g. a request going through the middleware and the page and tokens were being refreshed in both places. In this case we keep the very first refresh.
df00288
to
2ec0b64
Compare
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.
LGTM
Description of changes
Fixing duplicate Set-Cookie header may be added with in Next.js Page Router.
Issue #, if available
Description of how you validated changes
Checklist
yarn test
passesChecklist for repo maintainers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.