refactor: share the PRECHECK type at the top level

This commit is contained in:
Andy Burke 2025-08-08 17:38:15 -07:00
parent 41c7802a36
commit 18b58ba94a
4 changed files with 9 additions and 9 deletions

View file

@ -6,7 +6,7 @@
import * as fs from '@std/fs';
import * as path from '@std/path';
import * as media_types from '@std/media-types';
import { SERVER } from '../server.ts';
import { PRECHECK, SERVER } from '../server.ts';
import { getCookies } from '@std/http/cookie';
let PUT_PATHS_ALLOWED: string[] | undefined = undefined;
@ -18,7 +18,6 @@ export type HANDLER_METHOD = (
normalized_path: string,
server: SERVER
) => Promise<Response | undefined> | Response | undefined;
export type PRECHECK = (request: Request, meta: Record<string, any>) => Promise<Response> | Response | undefined;
export const PRECHECKS: Partial<Record<HTTP_METHOD, PRECHECK[]>> = {};
export const HANDLERS: Partial<Record<HTTP_METHOD, HANDLER_METHOD>> = {
HEAD: async (_request: Request, normalized_path: string, _server: SERVER): Promise<Response | undefined> => {