Unverified Commit 9faba368 authored by Damien Simonin Feugas's avatar Damien Simonin Feugas Committed by GitHub

docs(edge-api-routes): fixes example (#42903)

## 📖 What's in there?

The last example on the documentation page for [Edge Api routes](https://nextjs.org/docs/api-routes/edge-api-routes) is wrong since next@13 breaking change on cookie handling.
While [middleware page](https://nextjs.org/docs/advanced-features/middleware#using-cookies) is updated, this one was left off.
parent 230571cd
...@@ -95,7 +95,7 @@ export const config = { ...@@ -95,7 +95,7 @@ export const config = {
} }
export default async function handler(req: NextRequest) { export default async function handler(req: NextRequest) {
const authorization = req.cookies.get('authorization') const authorization = req.cookies.get('authorization')?.value
return fetch('https://backend-api.com/api/protected', { return fetch('https://backend-api.com/api/protected', {
method: req.method, method: req.method,
headers: { headers: {
......
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