Move request-id header name to $lib
This commit is contained in:
parent
13b1d57e08
commit
da92ed6258
@ -1,9 +1,7 @@
|
||||
import { log, timedExecution } from '$lib';
|
||||
import { log, timedExecution, requestIdHeader } from '$lib';
|
||||
import { validate, v7 as uuidv7 } from 'uuid';
|
||||
import type { Handle } from '@sveltejs/kit';
|
||||
|
||||
const requestIdHeader = 'x-request-id';
|
||||
|
||||
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);
|
||||
|
@ -29,6 +29,8 @@ if (!('STORAGE_PATH' in process.env)) {
|
||||
}
|
||||
export const storagePath: string = process.env.STORAGE_PATH ?? defaultPath;
|
||||
|
||||
export const requestIdHeader = 'x-request-id';
|
||||
|
||||
export default safePath;
|
||||
|
||||
export async function timedExecution<T>(
|
||||
|
Reference in New Issue
Block a user