mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This PR fixes an issue where users would try to access `req.cookies` from a route handler and be unable to read from it. This issue was caused by `req.cookies` not opting you into dynamic behaviour, unlike `cookies()` from `next/headers`. This fixes it.
13 lines
359 B
TypeScript
13 lines
359 B
TypeScript
import { getRequestMeta, withRequestMeta } from '../../../../helpers'
|
|
import { NextRequest } from 'next/server'
|
|
|
|
export async function GET(req: NextRequest) {
|
|
// Put the request meta in the response directly as meta again.
|
|
const meta = getRequestMeta(req.cookies)
|
|
|
|
return new Response(null, {
|
|
status: 200,
|
|
headers: withRequestMeta(meta),
|
|
})
|
|
}
|