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

fix(cookies): reverted node's getter back to raw() #63

Merged
merged 4 commits into from
Aug 18, 2022

Conversation

awtsui
Copy link
Contributor

@awtsui awtsui commented Aug 18, 2022

In the case that multiple set-cookie headers are received, the old implementation of headers.get('set-cookie') would return a string sequence, making parsing difficult. Using .raw() returns an array of strings, making parsing easier.

const setCookie = Cookie.parse(headers?.get('set-cookie') || '')
if (setCookie) {
cookieRecord[setCookie.key] = setCookie.value
const headerSetCookies = (headers as any).raw()[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a unit test for extractCookies? You can pass a mocked header object directly to _extractCookies instead of relying on login and fetch mock to mock headers

@satish-ravi satish-ravi merged commit ef6344c into main Aug 18, 2022
@satish-ravi satish-ravi deleted the awtsui/fix-get-cookies-index-node branch August 18, 2022 23:33
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

Successfully merging this pull request may close these issues.

2 participants