Class RateLimitHandler
- Namespace
- RateLimitClient
- Assembly
- RateLimitClient.dll
HttpMessageHandler that implements HTTP traffic shaping based on rate limit headers according to the IETF draft-ietf-httpapi-ratelimit-headers specification.
public class RateLimitHandler : DelegatingHandler
- Inheritance
-
objectHttpMessageHandlerDelegatingHandlerRateLimitHandler
Constructors
RateLimitHandler()
Creates a new RateLimitHandler with default options.
public RateLimitHandler()
RateLimitHandler(RateLimitHandlerOptions)
Creates a new RateLimitHandler with the specified options.
public RateLimitHandler(RateLimitHandlerOptions options)
Parameters
optionsRateLimitHandlerOptions
RateLimitHandler(RateLimitHandlerOptions, HttpMessageHandler)
Creates a new RateLimitHandler with the specified options and inner handler.
public RateLimitHandler(RateLimitHandlerOptions options, HttpMessageHandler innerHandler)
Parameters
optionsRateLimitHandlerOptionsinnerHandlerHttpMessageHandler
Methods
ClearState()
Clears all tracked rate limit state.
public void ClearState()
Dispose(bool)
Releases the unmanaged resources used by the System.Net.Http.DelegatingHandler, and optionally disposes of the managed resources.
protected override void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to releases only unmanaged resources.
GetTracker()
Gets the current rate limit tracker for diagnostics.
public RateLimitTracker GetTracker()
Returns
SendAsync(HttpRequestMessage, CancellationToken)
Sends an HTTP request with rate limiting applied.
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessagecancellationTokenCancellationToken
Returns
- Task<HttpResponseMessage>