@kleb/http (0.2.0)
Published 2026-07-04 18:56:11 +02:00 by kleb
Installation
@kleb:registry=npm install @kleb/http@0.2.0"@kleb/http": "0.2.0"About this package
@kleb/http
Framework-neutral HTTP helpers.
import { HttpError, errorResponse, jsonResponse, parseJsonBody } from "@kleb/http";
const body = await parseJsonBody(request);
if (!body) throw new HttpError(400, "Request body is required");
return jsonResponse({ ok: true });
parseJsonBody enforces a default 1 MiB body limit before parsing. Pass
{ maxBytes } when a route needs a smaller or larger JSON payload cap:
const body = await parseJsonBody(request, { maxBytes: 64 * 1024 });