Configuration Overview¶
HTTP Guardian configuration is read layer by layer. Each layer has a distinct responsibility.
| Layer | File or object | Responsibility |
|---|---|---|
| Client | HttpClientOptions |
Describes the target API and default behaviors. |
| Request | RequestOptions |
Describes what changes for one specific call. |
| Auth | AuthConfig |
Produces credentials at request time. |
| Parser | ApiParser |
Converts the raw response into ClientResult<T>. |
| Guards | HttpGuard[] |
Composes behaviors around the transport. |
| Plugins | HttpPlugin[] |
Applies cross-cutting policies when the client is created. |
Integration Checklist¶
- Provide a
baseUrlthat points to the API root, not to a final endpoint. - Declare
auth, even withnoAuth(). - Choose a parser that matches the backend's real envelope.
- Define non-sensitive global headers in
defaults.headers. - Put default timeouts and notifications at the client level.
- Enable cache only on idempotent reads.
- Add refresh, CSRF, and idempotency with documented exclusions.
Sound decision
When an option changes based on the user, route, or button, it often belongs to RequestOptions. When it changes based on the backend, it belongs to the client.