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): parse header correctly when merging cookies #1762

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

wilsonjackson
Copy link
Contributor

Fixes a parsing error introduced by an upstream fix in cookiejar: bmeck/node-cookiejar#38

Prior to 2.1.3, cookiejar was incorrectly producing cookie headers containing multiple cookies with no spaces after the separating semicolon. That space is explicitly required in the RFC.

When Supertest merges cookies provided with via .set() with cookies from its internal cookiejar instance, it assumes that incorrect, spaceless format. This results in any cookie names after the first in a given header erroneously containing leading spaces.

I added a test for cookie validity and the fix to split on ; instead of just ;.

Found this issue the same way as #1761, but it's actually unrelated. Fun! 😄

Checklist

  • I have ensured my pull request is not behind the main or master branch of the original repository.
  • I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
  • I have written a commit message that passes commitlint linting.
  • I have ensured that my code changes pass linting tests.
  • I have ensured that my code changes pass unit tests.
  • I have described my pull request and the reasons for code changes along with context if necessary.

@titanism titanism merged commit 4268ae4 into ladjs:master Jan 25, 2023
@titanism
Copy link
Collaborator

v8.0.9 released to npm and GitHub releases

https://github.com/ladjs/superagent/releases/tag/v8.0.9

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