Class PictureparkRetryHandler
Decorating
Inheritance
Namespace: System.Dynamic.ExpandoObject
Syntax
public class PictureparkRetryHandler : DelegatingHandler
Constructors
PictureparkRetryHandler(HttpMessageHandler, Int32)
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. |
System.Int32
maxRetries
Maximum number of retries before a request is failing. |
PictureparkRetryHandler(Int32)
Initializes a new instance of the PictureparkRetryHandler class to handle throttled requests (HTTP 429 Too many requests).
Uses the default
Declaration
public PictureparkRetryHandler(int maxRetries = 3)
Parameters
System.Int32
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 async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
HttpRequestMessage
request
The HTTP request message to send to the server. |
System.Threading.CancellationToken
cancellationToken
A cancellation token to cancel operation. |
Returns
System.Threading.Tasks.Task<HttpResponseMessage>
Returns System.Threading.Tasks.Task<TResult>. The task object representing the asynchronous operation. |
Exceptions
System.ArgumentNullException
The |