[PR #554] [MERGED] fix: add ResponseCookies.has() shim #669

Closed
opened 2026-05-06 13:09:27 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/554
Author: @NathanDrake2406
Created: 3/16/2026
Status: Merged
Merged: 3/16/2026
Merged by: @james-elicx

Base: mainHead: fix/response-cookies-has


📝 Commits (1)

  • 7c017f5 Add ResponseCookies.has()

📊 Changes

2 files changed (+15 additions, -0 deletions)

View changed files

📝 packages/vinext/src/shims/server.ts (+4 -0)
📝 tests/shims.test.ts (+11 -0)

📄 Description

Summary

This adds the missing ResponseCookies.has(name) method to the next/server shim and covers it with a regression test.

What Changed

  • added ResponseCookies.has(name) in packages/vinext/src/shims/server.ts
  • added a targeted ResponseCookies API test in tests/shims.test.ts

Why It Matters

RequestCookies already exposed has(), and Next.js documents NextResponse.cookies.has(name) as part of the public API. Without this method, middleware code like response.cookies.has("session") throws at runtime instead of returning a boolean.

Risks Or Limits

This is a small shim-surface change. has() delegates to get(), so it inherits the existing response-cookie parsing behavior rather than introducing a second code path.

Verification

  • ./node_modules/.bin/vp test run tests/shims.test.ts -t "response cookie exists"
  • ./node_modules/.bin/vp test run tests/shims.test.ts -t "ResponseCookies API|response cookie exists"
  • git diff --check

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/554 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 3/16/2026 **Status:** ✅ Merged **Merged:** 3/16/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/response-cookies-has` --- ### 📝 Commits (1) - [`7c017f5`](https://github.com/cloudflare/vinext/commit/7c017f55c581b5b3019ae969af64095cbbc3b80d) Add ResponseCookies.has() ### 📊 Changes **2 files changed** (+15 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/server.ts` (+4 -0) 📝 `tests/shims.test.ts` (+11 -0) </details> ### 📄 Description ## Summary This adds the missing `ResponseCookies.has(name)` method to the `next/server` shim and covers it with a regression test. ## What Changed - added `ResponseCookies.has(name)` in `packages/vinext/src/shims/server.ts` - added a targeted `ResponseCookies` API test in `tests/shims.test.ts` ## Why It Matters `RequestCookies` already exposed `has()`, and Next.js documents `NextResponse.cookies.has(name)` as part of the public API. Without this method, middleware code like `response.cookies.has("session")` throws at runtime instead of returning a boolean. ## Risks Or Limits This is a small shim-surface change. `has()` delegates to `get()`, so it inherits the existing response-cookie parsing behavior rather than introducing a second code path. ## Verification - `./node_modules/.bin/vp test run tests/shims.test.ts -t "response cookie exists"` - `./node_modules/.bin/vp test run tests/shims.test.ts -t "ResponseCookies API|response cookie exists"` - `git diff --check` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:27 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#669
No description provided.