diff --git a/src/content/docs/ko/guides/middleware.mdx b/src/content/docs/ko/guides/middleware.mdx index d51125dfd1b64..f30eac91f7147 100644 --- a/src/content/docs/ko/guides/middleware.mdx +++ b/src/content/docs/ko/guides/middleware.mdx @@ -23,6 +23,7 @@ import Since from '~/components/Since.astro'; // 요청의 응답 데이터 가로채기 // 선택적으로 `locals`의 속성을 수정합니다. context.locals.title = "새로운 제목"; + context.locals.property = "정보"; // Response 객체 또는 `next()` 함수의 호출 결과를 반환합니다. return next(); @@ -62,10 +63,12 @@ import Since from '~/components/Since.astro'; export function onRequest (context, next) { // 요청의 응답 데이터 가로채기 // 선택적으로 `locals`의 속성을 수정합니다. - context.locals.user.name = "John Wick"; + context.locals.user = { id: 1, name: "John Wick" }; context.locals.welcomeTitle = () => { - return "반가워요 " + locals.user.name; + return "반가워요 " + context.locals.user.name; }; + context.locals.orders = new Map([["1", { product: "양말" }]]); + context.locals.property = "정보"; // Response 객체 또는 `next()` 함수의 호출 결과를 반환합니다. return next();