Class PictureparkRetryHandler
Decorating HttpClientHandler which retries calls when HTTP 429 (Too many requests) is returned
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Syntax
public class PictureparkRetryHandler : DelegatingHandler, IDisposable
Constructors
PictureparkRetryHandler(int)
Initializes a new instance of the PictureparkRetryHandler class to handle throttled requests (HTTP 429 Too many requests). Uses the default HttpClientHandler inner handler.
Declaration
public PictureparkRetryHandler(int maxRetries = 3)
Parameters
int
maxRetries
Maximum number of retries before a request is failing. |
PictureparkRetryHandler(HttpMessageHandler, int)
Initializes a new instance of the PictureparkRetryHandler class to handle throttled requests (HTTP 429 Too many requests). Adds an inner handler for further processing.
Declaration
public PictureparkRetryHandler(HttpMessageHandler innerHandler, int maxRetries = 3)
Parameters
HttpMessageHandler
innerHandler
The inner handler. |
int
maxRetries
Maximum number of retries before a request is failing. |
Methods
SendAsync(HttpRequestMessage, CancellationToken)
Sends an HTTP request to the inner handler to send to the server as an asynchronous operation. Retries the request up to the specified maximum retries when encountering a response with the status code 429.
Declaration
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
HttpRequestMessage
request
The HTTP request message to send to the server. |
CancellationToken
cancellationToken
A cancellation token to cancel operation. |
Returns
Task<HttpResponseMessage>
Returns Task<TResult>. The task object representing the asynchronous operation. |
Overrides
Exceptions
ArgumentNullException
The |