Skip to content

Fix leading semicolon when stringifying cookies with skipped values - #267

Merged
blakeembrey merged 1 commit into
jshttp:masterfrom
saripovdenis:fix/leading_semicolon
Apr 27, 2026
Merged

Fix leading semicolon when stringifying cookies with skipped values#267
blakeembrey merged 1 commit into
jshttp:masterfrom
saripovdenis:fix/leading_semicolon

Conversation

@saripovdenis

Copy link
Copy Markdown
Contributor

Fixes stringifyCookie output when the first cookie entry has an undefined value.

Previously, separators were based on the loop index. If the first key was skipped, the next emitted cookie still got a leading ; :

stringifyCookie({ a: undefined, b: "2" })
// before: "; b=2"
// after: "b=2"

This changes separator insertion to check whether output has already been written.

Test added for the skipped-first-entry case.

Validation:

  • npm run specs -- src/stringify-cookie.spec.ts
  • npm test

@blakeembrey
blakeembrey merged commit 8e48f21 into jshttp:master Apr 27, 2026
2 checks passed
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