cc8ab99a92
Hello, This is an iteration after first work at https://github.com/vercel/next.js/pull/36478. What that PR missed is a way to just get a cookie value. Well, this PR adds two new things: `cookies.get` returns the cookie value that could be `string | undefined`: ```js const response = new NextResponse() response.cookies.set('foo', 'bar', { path: '/test' }) const value = response.cookies.get('foo') console.log(value) // => 'bar' ``` Additionally, if you want to know all the cookie details, you can use `cookies.getWithOptions`: ```js const response = new NextResponse() response.cookies.set('foo', 'bar', { path: '/test' }) const { value, options } response.cookies.getWithOptions('foo') console.log(value) // => 'bar' console.log(options) // => { Path: '/test' } ``` |
||
---|---|---|
.. | ||
cookies.ts | ||
fetch-event.ts | ||
request.ts | ||
response.ts |