HttpRetryState Class

Namespace
Kampute.HttpClient
Assembly
  • Kampute.HttpClient.dll

Definition

Holds the retry sessions of one call to an HttpRestClient, shared by every attempt of that call.
public sealed class HttpRetryState
Inheritance

Remarks

The HttpRestClient creates one instance for each call it sends, and passes it to every error context created for that call. Each component that handles a kind of failure, such as the client for connection failures or an IHttpErrorHandler for error responses, has its own retry session in this state, which counts its retries and measures the time since its first failure. Because the state belongs to the call rather than to a request, the sessions are kept even when an error handler retries with a request it built itself instead of a clone of the failed request.

Code that creates an HttpRequestErrorContext or HttpResponseErrorContext outside the client, such as a unit test of a custom error handler, creates a new instance for each call it simulates. An instance is not thread-safe, and must not be shared by calls that run concurrently.

See Also