@opovid/http
v0.1.7
Published
Generic HTTP ability adapter for Opovid.
Maintainers
Readme
@opovid/http
Thin HTTP ability for Opovid users and actors.
For the full debugging-first timeline feature overview, see ../../../docs/execution-timeline.md.
Install
npm install @opovid/http @opovid/coreUse
import { User } from "@opovid/core";
import { CallAnApi } from "@opovid/http";
const user = new User("Ari", [
CallAnApi.usingFetch(fetch, { baseUrl: "https://api.example.test" }),
]);
const response = await user.abilityTo(CallAnApi).get("/health");HTTP calls made inside recorded tasks are added to user.timeline() with redacted headers and status details. Body previews are omitted by default; opt in when they are safe for your project:
CallAnApi.usingFetch(fetch, {
baseUrl: "https://api.example.test",
timeline: { includeBodies: true, maxBodyLength: 1000 },
});Create a fresh CallAnApi ability per user or actor. Reusing one ability instance shares its request-id counter and, by the timeline wiring contract, sends events to the actor that attached it most recently.
Actor remains available as the lower-level compatibility API. See the root README for fuller API and test-flow examples.
