UNPKG

@sigiljs/sigil

Version:

TypeScript-first Node.js HTTP framework offering schema-driven routing, modifier-based middleware, plugin extensibility, and flexible response templating

28 lines (27 loc) 1 kB
import { IncomingMessage } from 'node:http'; import { IncomingRequestProcessorResponse } from './containers'; /** * Options for processing incoming HTTP requests. */ interface RequestProcessorOptions { /** * Whether to trust proxy headers when deriving the host. */ trustProxy?: boolean; /** * List of allowed hostnames for the request. */ expectedHosts?: string[]; } /** * Parses and processes an IncomingMessage into a structured request object. * Returns null if the request is invalid or not supported. * * @param req the raw incoming HTTP message from Node.js. * @param options optional settings for host validation and proxy trust. * @returns promise resolving to an IncomingRequestProcessorResponse, * or null if processing failed. * @throws Propagates errors from content handlers. */ export default function processRequestContent(req: IncomingMessage, options?: RequestProcessorOptions): Promise<IncomingRequestProcessorResponse | null>; export {};