/** * Response construction from a handler's return value: the header/cookie init, the fused-lane * responders, the fast JSON path, and cookie append. Imports only the runtime-core primitives + the * spine types, so the wire-response format lives in one module distinct from the request engine. */ import { type HandlerResult } from "./runtime-core.js"; import type { CtxSet, RawContext } from "./server.js"; import { type StaticResponseHeaders } from "./static-headers.js"; /** * Build the per-server shapes for a validated static header record. The JSON init is prebuilt once * here so a static-middleware app's fused JSON lane pays a shared init read instead of a header write * per declared name per request - the same reuse the hook-free lane already gets from * {@link JSON_INIT_200}. */ export declare function buildStaticResponseHeaders(record: Readonly>): StaticResponseHeaders; /** * Apply the static defaults to an ALREADY-BUILT response - the framework's error/404/timeout renders * and a handler-returned `Response`, none of which go through the header init below. Defaults, so a * name the response already carries is left alone. A guarded `Headers` (a raw `fetch()` result a * handler returned) rejects every write, so the first `set` throws with nothing applied and the * retry lands on a mutable copy. */ export declare function applyStaticResponseHeaders(response: Response, statics: StaticResponseHeaders): Response; export declare function responseJsonContentType(): string; export declare function knownMutableHeaders(headers: Headers): boolean; export declare function rememberMutableHeaders(headers: Headers): void; /** Normalize handler-produced bodyless responses before response middleware sees them. */ export declare function normalizeBodylessResponse(response: Response): Response; type ResponseBodyTagOption = false | true | object | undefined; /** The framework-serialized bytes riding a tagged Response, or `undefined` for raw/streamed ones. */ export declare function taggedResponseBody(response: Response, owners?: ReadonlySet): string | Uint8Array | undefined; export declare function taggedResponseOwner(response: Response): object | undefined; export declare function markTaggedResponse(response: Response, body: string | Uint8Array, owner?: object): Response; /** Fused-lane respond when `c.set` is untouched. Bun 1.3's native `Response.json` now beats the * older hand-inlined stringify + Response construction on this lane while preserving the exact * body/content-type contract; keep the generic fallback for non-JSON values. */ export declare function fusedRespondNoSet(result: unknown, tagResponseBody?: ResponseBodyTagOption, statics?: StaticResponseHeaders, unstamped?: boolean): Response; /** Fused-lane respond with a context: read `c.set` once; untouched (the common case) -> the fast * JSON respond; touched -> the generic `toResponse` with those controls (statuses, headers, cookies). */ export declare function fusedRespond(result: unknown, ctx: RawContext, tagResponseBody?: ResponseBodyTagOption, statics?: StaticResponseHeaders, unstamped?: boolean): Response; export declare function toResponse(result: HandlerResult, set: CtxSet, tagResponseBody?: ResponseBodyTagOption, statics?: StaticResponseHeaders): Response; export declare function appendCookiesToResponse(response: Response, set: CtxSet): Response; export {}; //# sourceMappingURL=respond.d.ts.map