Skip to main content

Module hooks

Module hooks 

Source
Expand description

Lifecycle hooks for requests and responses.

Hooks::on_request and Hooks::on_response return Result. To abort the client pipeline intentionally, return Err(Error::hook("reason")). Other Error variants (Transport, Http, …) are valid when a hook needs to surface a specific failure. Hooks::on_success, Hooks::on_error, and Hooks::on_retry cannot return errors.

Structs§

ErrorContext
Context when an error occurs.
Hooks
Lifecycle hooks for the HTTP client.
RequestContext
Context for an outgoing request.
ResponseContext
Context after a response is received.
SuccessContext
Context after a successful HTTP response (2xx).