Unverified Commit a0f37877 authored by Ayanwola Ayomide's avatar Ayanwola Ayomide Committed by GitHub

update middleware cookies example (#42341)

in the example at ## Using Cookies, the first example, the cookie header assumption was wrong. It first confused me, before I knew it was meant to be `nextjs` instead. Thanks for building an amazing library



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
parent 5654cae2
......@@ -160,7 +160,7 @@ import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
export function middleware(request: NextRequest) {
// Assume a "Cookie:vercel=fast" header to be present on the incoming request
// Assume a "Cookie:nextjs=fast" header to be present on the incoming request
// Getting cookies from the request using the `RequestCookies` API
const cookie = request.cookies.get('nextjs')?.value
console.log(cookie) // => 'fast'
......
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