Request
Planned APIs: This page documents the final request-client workflow.
commflow@0.0.2does not export a request runtime; do not use its imports as current production imports. See Current Release Quick Start for runnable exports.
When To Use It
request fits one-shot request/response communication:
Create A Client
Send A GET Request
request keeps fetch()-style semantics by default: HTTP 4xx/5xx is a response, not a transport error. Users should inspect response.ok, status codes, or project helpers for business failure.
Send A POST Request
POST and PATCH should not be retried aggressively by default. PUT and DELETE are often idempotent, but still require business idempotency and server-side guarantees before stronger retry is enabled.
Body, Query, And Content-Type
Default request helper rules:
Use Targets For Multiple Services
Targets let users organize calls by service name instead of scattering service URLs through application code.
Override One Call
Override order:
If timeout is omitted, commflow adds no timeout at this layer. If retry is omitted, it is 0. The default requestIdHeader is x-request-id.
Cancellation And Signal
When users pass signal and set timeout, commflow combines them. Whichever fires first cancels the request and throws a structured error with kind: 'aborted' or kind: 'timeout'.
Provide Request Context
Context is for cross-call data such as requestId, tenant, and trace metadata. Business input should remain explicit in body, query, or headers.
Use Lifecycle Hooks
Hooks are for logs, traces, header injection, and diagnostics. They should not hide core business branching. See Configuration for hook boundaries.
Error Handling
See Errors And Retries for the error model.
VextJS Relationship
The VextJS replacement path starts with request: timeout, retry, proxy, request context, and hook behavior currently owned by app.fetch should migrate into commflow request core. See VextJS Integration.