Unverified Commit 04311477 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

fix: `cookies().has()` breaks in app-route (#54112)

- Added `has` to ResponseCookies in [edge-runtime/cookies#533](https://github.com/vercel/edge-runtime/pull/533)
- Upgraded edge-runtime/cookies to 3.3.0 #54117 
- Added a test case


Fixes #54005 #54111
parent bd5b715d
...@@ -423,6 +423,16 @@ createNextDescribe( ...@@ -423,6 +423,16 @@ createNextDescribe(
}) })
}) })
describe('cookies().has()', () => {
it('gets the correct values', async () => {
const res = await next.fetch(bathPath + '/hooks/cookies/has')
expect(res.status).toEqual(200)
expect(await res.json()).toEqual({ hasCookie: true })
})
})
describe('redirect', () => { describe('redirect', () => {
it('can respond correctly', async () => { it('can respond correctly', async () => {
const res = await next.fetch(bathPath + '/hooks/redirect', { const res = await next.fetch(bathPath + '/hooks/redirect', {
......
import { NextResponse } from 'next/server'
import { cookies } from 'next/headers'
export async function GET() {
const c = cookies()
c.set('a', 'a')
const hasCookie = c.has('a')
return NextResponse.json({ hasCookie }) // expect { hasCookie: true }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment