Skip to content

fix(to-response): preserve multiple Set-Cookie when merging headers#137

Merged
bytaesu merged 3 commits into
mainfrom
fix/to-response-multiple-set-cookie
Apr 29, 2026
Merged

fix(to-response): preserve multiple Set-Cookie when merging headers#137
bytaesu merged 3 commits into
mainfrom
fix/to-response-multiple-set-cookie

Conversation

@bytaesu

@bytaesu bytaesu commented Apr 29, 2026

Copy link
Copy Markdown
Member

Co-authored-by: Rastislav ₡ore <rastislav@onion.email>
Copilot AI review requested due to automatic review settings April 29, 2026 04:47
@pkg-pr-new

pkg-pr-new Bot commented Apr 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/better-call@137

commit: 58e13a9

@bytaesu bytaesu added the backport v1.3.x Backport this PR to v1.3.x branch label Apr 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes toResponse() header merging so that multiple Set-Cookie headers are preserved (instead of being overwritten) when building/merging Response objects, addressing issue #118.

Changes:

  • Add a copyHeaders() helper that append()s Set-Cookie while set()ing all other headers.
  • Update toResponse() header merge points (existing Response branch and _flag: "json" branch) to use copyHeaders().
  • Add tests covering multi-Set-Cookie preservation across the relevant merge scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/better-call/src/to-response.ts Introduces copyHeaders() and updates merge logic to preserve multiple Set-Cookie values.
packages/better-call/src/to-response.test.ts Adds a dedicated test block validating multi-Set-Cookie preservation and router header propagation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bytaesu bytaesu merged commit faf741d into main Apr 29, 2026
3 checks passed
@better-release

Copy link
Copy Markdown

Successfully created backport PR for v1.3.x:

bytaesu added a commit that referenced this pull request Apr 29, 2026
…137) (#142)

(cherry picked from commit faf741d)

Co-authored-by: Taesu <166604494+bytaesu@users.noreply.github.com>
Co-authored-by: Rastislav ₡ore <rastislav@onion.email>
@rastislavcore

Copy link
Copy Markdown
Contributor

@bytaesu Can we produce release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport v1.3.x Backport this PR to v1.3.x branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toResponse overwrites multiple Set-Cookie headers

3 participants