@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 });
Details
npm
2026-07-04 18:56:11 +02:00
4
UNLICENSED
13 KiB
Assets (1)
Versions (6) View all
0.5.0 2026-07-20
0.4.0 2026-07-14
0.3.0 2026-07-07
0.2.0 2026-07-04
0.1.1 2026-07-03