@healthzkit/http package provides a HealthAdapter that probes an HTTP or HTTPS endpoint with the global fetch API. Each check records round-trip latency, validates the response status against expectedStatusCodes, and returns ok with metadata.statusCode and metadata.latencyMs on success. Unexpected status codes, timeouts, and transport errors return fail with the caught error.
Requires a runtime with global fetch. No peer client package.
Install
Package entrypoints
@healthzkit/http—httpAdapterand option types.@healthzkit/http/http—httpAdapteronly.
Shared options
BaseHttpOptions:
httpAdapter
Defaults
Basic readiness check
Authenticated POST probe
Redirects and metadata
SetfollowRedirects: false to use redirect: "manual" (useful when you need to detect redirects explicitly). Use metadata to read headers or body-related facts from the Response:
Check metadata
Successful checks include the HTTP status alongside any custommetadata hook output:
fail with a message like Unexpected status code: 503 Service Unavailable. Request timeouts abort via AbortSignal and return fail with Request timed out after <timeout>ms.
Wiring into createHealthKit
Treat the factory return value as adapter on a check (same as a hand-written { check() { ... } } object):
schedule on the check if you want cached readiness results instead of calling the upstream on every probe (see Scheduling).