@web/sensible
v1.0.0
MIT
.cap
✓ Verified by capdux.org
AI-First .d.cp
Official RFC 9457 Problem Details & standard HTTP error helpers plugin for cap:web (inspired by @fastify/sensible)
Install with Cap
$ cap add @web/sensible
AI Interface Stub .d.cp
// Type definitions for CP
import { App, AppMethod, Context, Response, Plugin, PluginScope } from "../../../../lib/web/app.cp";
export class SensibleConfig {
expose_problem_type_base: string,
default_error_header: string,
}
export fn sensWriteRaw(dst: []u8, pos: &mut usize, s: string): bool;
export fn sensWriteEscaped(dst: []u8, pos: &mut usize, s: string): bool;
export fn sensWriteU16(dst: []u8, pos: &mut usize, v: u16): bool;
export fn problemResponse(status_code: u16, title: string, detail: string): Response;
export fn httpBadRequest(detail: string): Response;
export fn httpUnauthorized(detail: string): Response;
export fn httpForbidden(detail: string): Response;
export fn httpNotFound(detail: string): Response;
export fn httpConflict(detail: string): Response;
export fn httpUnprocessable(detail: string): Response;
export fn httpTooManyRequests(detail: string): Response;
export fn httpInternalError(detail: string): Response;
export fn sensibleAssert(ctx: &mut Context, cond: bool, status_code: u16, title: string, detail: string): bool;
export fn sensibleAfterHook(ctx: &mut Context, resp: &mut Response);
export fn createSensiblePlugin(cfg: SensibleConfig): Plugin;
export fn registerSensible(app: &mut App, cfg: SensibleConfig): &mut App;
README
MarkdownNo README provided for this package version.
Version History
1 release| Version | Format / Size | Integrity (SHA-256) | Downloads | Published | Status |
|---|---|---|---|---|---|
| v1.0.0 | .cap · 2.4 KB | sha256-f315e3646a6e8cf2… | 0 | 2026-11-26 | latest |