Skip to content

fix(cookies): parse header correctly when merging cookies#1762

Merged
titanism merged 1 commit into
forwardemail:masterfrom
Leafly-com:fix-cookie-header
Jan 25, 2023
Merged

fix(cookies): parse header correctly when merging cookies#1762
titanism merged 1 commit into
forwardemail:masterfrom
Leafly-com:fix-cookie-header

Conversation

@wilsonjackson

Copy link
Copy Markdown
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 forwardemail:master Jan 25, 2023
@titanism

Copy link
Copy Markdown
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