OptionalafterCalled after a successful response is received.
Returning a Response replaces the original response.
OptionalbeforeCalled before an error is thrown. Can transform or enrich the error before it reaches the caller. The returned error replaces the original.
OptionalbeforeCalled before every request is sent. Can be used to log, modify headers, or add tracing information.
OptionalbeforeCalled before a retry attempt. Useful for logging retry attempts or modifying the request between retries.
Lifecycle hooks that are invoked at various stages of a request.
All hook arrays are executed serially in order. Hooks can be synchronous or asynchronous.