Documentation / @zerotal/core / http
http
The @zerotal/core/http module — everything for talking HTTP from the
server side and shaping HTTP responses. It groups five concerns:
- Outbound requests — the Http facade and its fluent
PendingRequest builder for server-to-server calls, with headers,
auth, timeouts, retries, and a
fake()test harness. - URL building & signing — the immutable Uri value object (uri) and the app-aware Url service (url) for fully-qualified, named-route, and HMAC-signed links.
- Uploads — UploadedFile for validating and storing multipart form files.
- API resources — Resource and ResourceCollection for transforming models into JSON response envelopes.
- Content negotiation — negotiate / detectChannel for branching a handler by web / JSON / CLI client.
Example
import { Http, uri } from '@zerotal/core/http';
const target = uri('https://api.example.com/users').withQuery({ page: 2 }).value();
const users = await Http.withToken(token).timeout(5000).get(target).json();
@packageDocumentation
Classes
- Http
- HttpClientResponse
- HttpClientError
- PendingRequest
- Resource
- ResourceCollection
- UploadedFile
- Uri
- UrlKeyMissingError
Interfaces
- FakeStub
- PaginatedData
- FileValidationOptions
- UriQueryString
- WebContext
- ApiContext
- CliContext
- NegotiateMap
- UrlGenerator