histoire
Version:
A fast story book powered by Vite
23 lines • 1.01 kB
TypeScript
/**
* Maximum size (in characters) of a body the dev server accepts.
*
* Story collection results are the biggest legitimate payload and stay orders
* of magnitude below this; without a cap, any process able to reach the dev
* server can grow the buffer until the server runs out of memory.
*/
export declare const MAX_REQUEST_BODY_SIZE: number;
/** Thrown when a request body exceeds {@link MAX_REQUEST_BODY_SIZE}. */
export declare class RequestBodyTooLargeError extends Error {
constructor();
}
/**
* Reads a whole HTTP request body as a UTF-8 string, up to
* {@link MAX_REQUEST_BODY_SIZE}.
*
* Shared by every Histoire dev-server middleware that takes a JSON payload
* from a browser runtime (story collection results, Vitest mock resolution).
* @param req The incoming request stream.
* @throws {RequestBodyTooLargeError} When the body exceeds the size cap.
*/
export declare function readRequestBody(req: NodeJS.ReadableStream): Promise<string>;
//# sourceMappingURL=http-body.d.ts.map