Skip to content

fix: preserve session cookie priority - #358

Open
lprnmns wants to merge 1 commit into
fastify:mainfrom
lprnmns:fix-cookie-priority-option
Open

lprnmns wants to merge 1 commit into
fastify:mainfrom
lprnmns:fix-cookie-priority-option

Conversation

@lprnmns

@lprnmns lprnmns commented Aug 31, 2026

Copy link
Copy Markdown

The public CookieOptions type accepts the cookie priority option, but the internal session Cookie model dropped that value before calling reply.setCookie. As a result, valid low, medium, and high values never produced a Priority attribute.

This preserves priority alongside the existing cookie properties and includes it in the serialized cookie options. A focused integration test verifies that priority: 'high' emits Priority=High.

Validation:

  • node --test --test-name-pattern='should set session cookie with priority' test/cookie.test.js
  • npm run test && npm run benchmark --if-present
  • npm run lint

The full suite passes with 129 unit tests, 47 TypeScript assertions, and 100% reported coverage. The change is backward-compatible for existing configurations: an undefined priority remains omitted, while already-typed valid values now reach the underlying cookie serializer.

No issue is linked; this was independently reproduced on current main.

Checklist

  • run npm run test && npm run benchmark --if-present
  • tests and/or benchmarks are included
  • documentation is changed or added (the existing public type already exposes this option)
  • commit message and code follows the Developer's Certificate of Origin and the Code of conduct

Signed-off-by: lprnmns <manasalperen@gmail.com>
@lprnmns
lprnmns marked this pull request as ready for review August 31, 2026 16:20
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.

1 participant