/** * Shared redirect safety helpers for all adapters. * * Guarantees: * - Location is free of CR/LF/NUL (header-injection boundary) * - Dangerous URI schemes (javascript/data/vbscript/file) are rejected * - Non-ASCII / non-header-safe bytes are percent-encoded so * Node's setHeader / validateHeaderValue never throws mid-send * - Already-percent-encoded sequences and ASCII URI structure are preserved * - Only 301/302/303/307/308 are accepted; everything else coerces to 302 */ export type RedirectStatus = 301 | 302 | 303 | 307 | 308; /** * Normalize a redirect status code. * * Allowed: 301, 302, 303, 307, 308. * Missing / invalid values coerce to 302 (never hang or leak a raw 999). */ export declare function normalizeRedirectStatus(status?: number | null): RedirectStatus; /** * Normalize a redirect Location value. * * - Rejects CR/LF/NUL with HttpError 400 (bounded failure before send) * - Rejects javascript/data/vbscript/file schemes with HttpError 400 * - Percent-encodes non-ASCII so the value is a valid HTTP header token * for Node's validateHeaderValue / setHeader * - Leaves already-encoded sequences and URI-reserved ASCII intact * * @throws {HttpError} when location is unsafe or not a string */ export declare function normalizeRedirectLocation(url: string): string; /** * Prepare redirect status + Location for adapters. * Call this *before* marking the response as sent. */ export declare function prepareRedirect(url: string, status?: number | null): { location: string; status: RedirectStatus; };