OptionalBasePrefix applied to every relative request URL.
OptionalBasicDefault HTTP Basic credentials applied to every request.
OptionalHeadersHeaders merged under each request's own headers.
OptionalMaxDefault maximum redirect hops. Default: 5.
OptionalMaxMaximum retry attempts allowed when OnRetry asks for one. Default: 3.
OptionalOnCalled before each request with the fully merged config; return the config to actually send. The replacement for an axios request interceptor — this is where token injection, request signing, and per-request query defaults belong.
Treat the incoming config as immutable and return a new object; it is re-derived on every retry attempt, so a token read here is always current rather than captured at construction.
OptionalOnCalled after each successful response. Observation only: whatever this does, the response is still returned to the caller unchanged. Replaces the success half of an axios response interceptor — logging, metrics, and rate-limit headroom tracking belong here.
OptionalOnCalled when a request fails. Return true to retry, false to let the error propagate.
Replaces the error half of an axios response interceptor — 429 back-off, and one-shot token
refresh on a 401, belong here.
Retries are bounded by MaxRetries (default 3) so a hook that always returns true cannot
loop forever. Await the back-off inside the hook; the retry fires as soon as it resolves, and
OnRequest runs again first, so a refreshed token is picked up automatically.
Only an HttpError reaches this hook — an SSRFError is a security decision and is never retried.
OptionalTimeoutDefault request timeout in milliseconds. Default: 30000.
OptionalValidateWhen true, every request runs through the SSRF guard. Default: false.
Per-instance defaults and hooks for HttpClient.
The three hooks replace what axios interceptors did, with one important difference: they are plain options on the instance rather than entries appended to a mutable global chain, so what a given client does is visible at its construction site and cannot be changed from elsewhere.
interceptors.request.use(fn)interceptors.response.use(onOk)interceptors.response.use(_, onErr)