Skip to content

fix: preserve zero cookie values#184

Open
raashish1601 wants to merge 1 commit into
pillarjs:masterfrom
raashish1601:codex/101-cookie-zero-value
Open

fix: preserve zero cookie values#184
raashish1601 wants to merge 1 commit into
pillarjs:masterfrom
raashish1601:codex/101-cookie-zero-value

Conversation

@raashish1601

Copy link
Copy Markdown

Summary

Numeric 0 is a valid cookie value, but the Cookie constructor used value || "", which converted it to an empty string and marked the cookie for deletion. This preserves 0 as "0" while keeping the existing deletion behavior for null and empty values.

Fixes #101.

Validation

  • npm test -- --grep "zero value|numeric zero|when value is falsy"
  • npm run lint
  • npm test

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.

Cookie set to '' when pass the value as 0

1 participant