From 3160923f7ee9dc5597cb43501f8348b13829fcaf Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sat, 17 Aug 2024 16:49:38 +0200 Subject: [PATCH] Fix typos and define handler in TSy way --- src/hooks.server.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hooks.server.ts b/src/hooks.server.ts index cf156c0..4c99ccb 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,11 +1,11 @@ import { log, timedExecution } from '$lib'; import { validate, v7 as uuidv7 } from 'uuid'; +import type { Handle } from '@sveltejs/kit'; const requestIdHeader = 'x-request-id'; -/** @type {import('@sveltejs/kit').Handle} */ -export async function handle({ event, resolve }) { - // use incomming requestId, if it is a valid uuid, else generate one +export const handle: Handle = async ({ event, resolve }) => { + // use incoming requestId, if it is a valid uuid, else generate one const reqIdFromRequest = event.request.headers.get(requestIdHeader); const { requestId, fromRequest } = reqIdFromRequest && validate(reqIdFromRequest) @@ -20,7 +20,7 @@ export async function handle({ event, resolve }) { clientIP: event.getClientAddress(), }; if (fromRequest) { - log.trace(context, 'using incomming request-id'); + log.trace(context, 'using incoming request-id'); } // make requestId available to handlers @@ -42,4 +42,4 @@ export async function handle({ event, resolve }) { ); return response; -} +};