mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #761] [MERGED] fix: ResponseCookies deduplicate Set-Cookie headers and add missing API surface #824
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#824
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/761
Author: @NathanDrake2406
Created: 4/3/2026
Status: ✅ Merged
Merged: 4/3/2026
Merged by: @james-elicx
Base:
main← Head:fix/response-cookies-correctness📝 Commits (3)
9a2338ffix: ResponseCookies deduplicate Set-Cookie headers and add missing API surfacef0a1979fix: only forward path/domain in ResponseCookies.delete()6dce232fix: forward httpOnly/secure/sameSite in ResponseCookies.delete()📊 Changes
2 files changed (+322 additions, -69 deletions)
View changed files
📝
packages/vinext/src/shims/server.ts(+93 -67)📝
tests/shims.test.ts(+229 -2)📄 Description
Summary
ResponseCookies.set()unconditionally appended Set-Cookie headers — setting the same cookie name twice produced duplicate headers, andget()returned the stale first match. Rewritten to use an internalMap<name, {serialized, entry}>as the single source of truth (matching@edge-runtime/cookies's architecture). The_syncHeaders()method deletes all Set-Cookie headers and re-appends from the map on every mutation.set({ name, value, httpOnly, ... })matching Next.js docs and middleware patterns.getAll(name?)andgetAll({ name }).delete({ name, path, domain })with path/domain propagation.get()accepts object formget({ name })matching edge-runtime.delete()now usesExpires=epoch(matching edge-runtime) instead ofMax-Age=0.delete()now forwardshttpOnly,secure, andsameSiteattributes (matching edge-runtime — browsers need matchingSecureto actually delete a cookie).set()now defaultsPath=/when no path option is given (previously omittedPathentirely). This matches@edge-runtime/cookies'snormalizeCookiebehavior.Test plan
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.