Skip to content

Commit

Permalink
[docs] update handle hooks docs (#3433)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishrasatyam authored Jan 20, 2022
1 parent 9efebb1 commit 192a8fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions documentation/docs/04-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ export interface Handle<Locals = Record<string, any>> {
}
```

To add custom data to the request, which is passed to endpoints, populate the `request.locals` object, as shown below.
To add custom data to the request, which is passed to endpoints, populate the `event.locals` object, as shown below.

```js
/** @type {import('@sveltejs/kit').Handle} */
export async function handle({ request, resolve }) {
request.locals.user = await getUserInformation(request.headers.cookie);
export async function handle({ event, resolve }) {
event.locals.user = await getUserInformation(event.request.headers.get('cookie'));

const response = await resolve(request);
const response = await resolve(event);
response.headers.set('x-custom-header', 'potato');

return response;
Expand Down

0 comments on commit 192a8fe

Please sign in to comment.