Skip to content

fix: register onSend writer even when hook is false#360

Open
0XFF-96 wants to merge 1 commit into
fastify:mainfrom
0XFF-96:fix/hook-false-setcookie
Open

fix: register onSend writer even when hook is false#360
0XFF-96 wants to merge 1 commit into
fastify:mainfrom
0XFF-96:fix/hook-false-setcookie

Conversation

@0XFF-96

@0XFF-96 0XFF-96 commented Jul 7, 2026

Copy link
Copy Markdown

Previously the onSend handler that flushes queued cookies to the Set-Cookie header was gated by the same if (hook) block as the parsing hook, so registering the plugin with hook: false made reply.setCookie() a silent no-op. The docs scope hook to cookie parsing only, so the writer should be registered unconditionally. It already early-returns when no cookies were queued, so this is a no-op unless setCookie is used.

Adds a regression test.

Issue Link:#359

Checklist

Previously the onSend handler that flushes queued cookies to the Set-Cookie
header was gated by the same `if (hook)` block as the parsing hook, so
registering the plugin with `hook: false` made reply.setCookie() a silent
no-op. The docs scope `hook` to cookie parsing only, so the writer should be
registered unconditionally. It already early-returns when no cookies were
queued, so this is a no-op unless setCookie is used.

Adds a regression 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.

2 participants