Skip to content

Commit

Permalink
update middleware cookies example (#42341)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
devvspaces committed Nov 3, 2022
1 parent 5654cae commit a0f3787
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/advanced-features/middleware.md
Expand Up @@ -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'
Expand Down

0 comments on commit a0f3787

Please sign in to comment.