dotnet / dotnet/runtime

Provide rate limit http header to parse rate limits and create header values

Open
#121,302 3 comments 1 reaction 0 assignees View on GitHub
api-suggestion area-System.Net.Http
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

I am creating a throttler for my own code, based on rate limit headers returned from several services and had to implement code that parses rate limits from headers which seems to be a standard https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/.
Headers that I use: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

### Describe the solution you'd like

Since we already have `AuthenticationHeaderValue` and `HttpRequestMessage.Headers.Authorization` I think it might make sense to have `RateLimitHeaderValue`, `RateLimitRemainingHeaderValue`, `RateLimitResetHeaderValue` types defined somewhere in RateLimiting namespace and `HttpRequestMessage.Headers.RateLimit` extension that would return those values.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.