Table of Contents

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
object
HttpMessageHandler
DelegatingHandler
RateLimitHandler

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

options RateLimitHandlerOptions

RateLimitHandler(RateLimitHandlerOptions, HttpMessageHandler)

Creates a new RateLimitHandler with the specified options and inner handler.

public RateLimitHandler(RateLimitHandlerOptions options, HttpMessageHandler innerHandler)

Parameters

options RateLimitHandlerOptions
innerHandler HttpMessageHandler

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

disposing bool

true 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

RateLimitTracker

SendAsync(HttpRequestMessage, CancellationToken)

Sends an HTTP request with rate limiting applied.

protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Parameters

request HttpRequestMessage
cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>