HttpError503Handler Class

Namespace
Kampute.HttpClient.ErrorHandlers
Assembly
  • Kampute.HttpClient.dll

Definition

Handles '503 Service Unavailable' HTTP responses by attempting to back off and retry the request according to a specified or default backoff strategy.
public class HttpError503Handler : RetryableHttpErrorHandler
Inheritance

Remarks

This handler provides a mechanism to respond to HTTP 503 errors by retrying the request after a delay. The delay duration and retry logic can be customized through the RetryableHttpErrorHandler.OnBackoffStrategy delegate. If the delegate is not provided, or does not specify a strategy, the handler will look for a Retry-After header in the response. If the Retry-After header is present, its value is used to determine the backoff duration. If the header is not present, the default backoff strategy of the HttpRestClient is used.

Consider using TransientHttpErrorHandler if you want to handle multiple transient HTTP errors (including 503) with a single handler.

Methods

CanHandle(HttpStatusCode)

Determines whether this handler can process the specified HTTP status code.
public sealed override bool CanHandle(HttpStatusCode statusCode)

Parameters

statusCode HttpStatusCode
The HTTP status code to evaluate.

Returns

bool
true if the handler can process the status code; otherwise, false.

Remarks

This implementation specifically handles the HTTP '503 Service Unavailable' status code.

See Also