Skip to content

fix: support cookie v2.x#361

Merged
mcollina merged 2 commits into
mainfrom
fix/support-cookie-v2
Jul 9, 2026
Merged

fix: support cookie v2.x#361
mcollina merged 2 commits into
mainfrom
fix/support-cookie-v2

Conversation

@Tony133

@Tony133 Tony133 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Proposal:

Change

  • Import parseCookie / stringifySetCookie from cookie v2.x and wrap them in local parse(str, opts) / serialize(name, value, opts) helpers that preserve the old 3-argument call shape.
  • Route all internal usages (setCookie, clearCookie, request cookie parsing, the serializeCookie/parseCookie decorators, and the module.exports.serialize/.parse aliases) through these wrappers, so the plugin's public API is unchanged.
  • Bump cookie to ^2.0.0 in package.json.
  • Fix two README links that referenced cookie v1's old anchor names.

 v2 removed the / exports in favour of
/, which broke every route that
sets or reads a cookie (all requests returned 500).

- adapt to the new cookie@2 API while keeping the historic
   /  signatures
  for @fastify/cookie's own public API (fastify.parseCookie,
  fastify.serializeCookie, module.exports.parse/serialize)
- bump the  dependency to ^2.0.0
- fix README links that pointed to now-outdated  v1 anchors
@Tony133 Tony133 force-pushed the fix/support-cookie-v2 branch from ac9e996 to 97dcc90 Compare July 9, 2026 07:42
@Tony133 Tony133 marked this pull request as ready for review July 9, 2026 07:45
@Tony133 Tony133 requested a review from a team July 9, 2026 07:45
@Fdawgs

Fdawgs commented Jul 9, 2026

Copy link
Copy Markdown
Member

A lot of stylistic changes in here?

Likewise I wouldn't class this as a fix, it's just a dependency update isn't it?

@Tony133

Tony133 commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

A lot of stylistic changes in here?

Likewise I wouldn't class this as a fix, it's just a dependency update isn't it?

Is a dependency update that required some changes due to the renaming of certain function

Comment thread index.js Outdated

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit df7fe0d into main Jul 9, 2026
17 checks passed
@mcollina mcollina deleted the fix/support-cookie-v2 branch July 9, 2026 10:05
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.

5 participants