/** * The static response-header tier: registration-time validation, the prebuilt per-server shapes the * render paths reuse, and the one merge routine every lane folds them in with. * * A statically declared header is a DEFAULT. It carries no per-request decision, so it does not need * to run as a response hook - it is folded into response construction instead, which is what lets an * app whose only response middleware is static keep the fused/native lanes a real `onResponse` hook * would have cost it. Anything the request itself produced (`c.set.headers`, a cookie, a response * hook) is applied later and therefore wins. */ /** The per-server shapes built once from a validated static record. */ export interface StaticResponseHeaders { /** Lowercase-keyed and frozen: shared by every request, so no lane may mutate it. */ readonly record: Readonly>; /** `record` as pairs, for applying to an already-built `Headers`/`Response`. */ readonly entries: ReadonlyArray; /** The static record plus the content-type the framework's own JSON init carries, prebuilt. A * `Response` init is copied into the response, never retained, so one instance serves every * request. */ readonly jsonHeaders: Headers; /** `{ status: 200, headers: jsonHeaders }` - a static app's whole per-response header cost. */ readonly jsonInit200: ResponseInit; /** * The same shape, but carrying the content-type THIS runtime's `Response.json` emits - which is not * always the framework init's (Deno omits the charset). Used by the lane that would otherwise call * `Response.json`, so declaring headers never changes the content-type. Probed on first use: * workerd forbids `Response.json()` during startup, and declarations happen at startup. */ responseJsonInit200(): ResponseInit; } /** * Validate a declared record and lowercase its names once, at registration. Every rejection is a * programming error surfaced loudly at wire-up rather than a header silently missing (or, for the * refused names, silently corrupting framing) on every response afterwards. */ export declare function normalizeStaticResponseHeaders(record: Readonly>): Record; /** * Fold the static defaults UNDER a record the request produced. A name the request set wins, keeping * the casing it used; when the two spellings differ only by case, the static entry is dropped rather * than left alongside - one header name spelled two ways in a single record ships as a comma-joined * value on the Web paths and as two lines on Node, so writing the static entry blind would change * the wire instead of being overridden. * * `markLowercase` asks for the all-lowercase proof to be published on the result when it holds. The * merge is the natural place to answer that: the static names were lowercased at registration, and * the loop below already derives `lower` for every own name to decide the override, so `lower !== * name` is the whole answer at no added cost. Only the Node-direct lane asks - its readers are the * ones that would otherwise re-walk these keys - and only for an app with no raw native response * twin, since such a twin writes the record past the case-normalizing view AFTER this runs. */ export declare function mergeStaticHeaderRecord(statics: Readonly>, own: Readonly>, markLowercase?: boolean): Record; /** * A fresh, mutable copy of the static record - what the lanes whose writers mutate the record get. * Every name in it was lowercased at registration, so `markLowercase` publishes a proof that needs no * scan at all; the gate on it is the same one {@link mergeStaticHeaderRecord} documents. */ export declare function staticHeaderRecordCopy(statics: StaticResponseHeaders, markLowercase?: boolean): Record; //# sourceMappingURL=static-headers.d.ts.map