import { type HttpRequest } from "../http/index.js"; import { ClientError } from "../util/index.js"; export declare class MissingHeaderError extends ClientError { constructor(headerName: string); } /** * Extractor that extracts a raw header from the request. * * If the `required` flag is not set or false, returns either the header or * undefined. * * Otherwise, it throws an error if the header is missing. * * @example * ```ts * import { header } from "@taxum/core/extract"; * import { m, Router } from "@taxum/core/routing"; * * const handler = handler([header("if-none-match")], (etag) => { * // ... * }); * * const router = new Router() * .route("/users", m.get(handler)); * ``` * * @throws {@link MissingHeaderError} if header is required but missing. */ export declare const header: (headerName: string, required?: B) => (req: HttpRequest) => Promise;