Files
Jimmy LaiandGitHub 8baf2e0b79 route handlers: make req.cookies opt you into dynamic (#58769)
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.
2023-11-22 14:29:01 +00:00

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),
})
}