import type { IncomingMessage, ServerResponse } from "node:http"; import type { FilesApi } from "../api/index.js"; /** A Node request, optionally carrying Express's `originalUrl` (the pre-mount path). */ export type NodeLikeRequest = IncomingMessage & { originalUrl?: string; }; /** * Marshal a Node request into the Web `Request` the gateway consumes. * * `body` overrides the request stream: pass it when the payload doesn't live on * `req` as a readable stream (an in-process mock request carries it on a * property instead); `null` sends no body. `url` overrides the request path * (e.g. Koa's `ctx.originalUrl` under a mount). */ export declare const toWebRequest: (req: NodeLikeRequest, signal: AbortSignal, overrides?: { body?: BodyInit | null; url?: string; }) => Request; /** Flush a Web `Response` (status, headers, streamed body) onto the Node response. */ export declare const sendWebResponse: (res: ServerResponse, response: Response) => Promise; /** * An `AbortSignal` that fires when the client disconnects before the response * finishes — for bindings that return the `Response` to the framework to flush * (e.g. Nitro). The connection socket's `close` is the one disconnect event * that fires across Node and Bun; `res`'s own `close` covers runtimes that * report the disconnect there first. Both listeners come off once `res` * finishes or closes, so a keep-alive socket serving many requests doesn't * accumulate one per request. A socket without an event API (an in-process * mock request) yields a signal that never aborts. */ export declare const abortSignalForNodeRequest: (req: IncomingMessage, res: ServerResponse) => AbortSignal; /** * Run the gateway against a Node request/response pair: marshal the request, * dispatch, and flush the response, wiring a client disconnect through to the * upstream read. This is the whole binding for `express`/`koa`/`fastify` — each * only has to hand over its underlying `(req, res)`. */ export declare const handleNodeRequest: (router: FilesApi, req: NodeLikeRequest, res: ServerResponse, overrides?: { url?: string; }) => Promise; //# sourceMappingURL=node-http.d.ts.map