Fix typos and define handler in TSy way
This commit is contained in:
parent
37d6cd848d
commit
3160923f7e
@ -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;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user