Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send rate limit headers when request is successful #4

Open
cristipufu opened this issue Nov 6, 2022 · 1 comment
Open

Send rate limit headers when request is successful #4

cristipufu opened this issue Nov 6, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@cristipufu
Copy link
Owner

Custom middleware

public interface IRateLimiterPolicy<TPartitionKey>
{
    Func<OnRejectedContext, CancellationToken, ValueTask>? OnRejected { get; }
+   Func<OnAcquiredContext, CancellationToken, ValueTask>? OnAcquired { get; }
}
public sealed class RateLimiterOptions
{
    public Func<OnRejectedContext, CancellationToken, ValueTask>? OnRejected { get; set; }
+    public Func<OnAcquiredContext, CancellationToken, ValueTask>? OnAcquired { get; set; }
}

dotnet/aspnetcore#44140

@cristipufu cristipufu added the enhancement New feature or request label Nov 6, 2022
@hacst
Copy link
Contributor

hacst commented Jan 4, 2024

The API proposal for the feature request on the .NET side for this is in dotnet/aspnetcore#45658 and seems to be going into another direction.

There's a IRateLimiterStatisticsFeature portion which is actually intended to provide info for rate limit headers but it seems the discussion got bogged down on the specifics of that. TBO I am unsure whether it can even be made to work as well as the lease metadata approach for most of the limiters here. I think the thing that might be available the quickest is the part of the proposal that introduces a IRateLimiterLeaseFeature. That would make the lease available from middleware solving this issue here.

Lets see if they are up for my proposal to advance the IRateLimiterLeaseFeature independently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants
@hacst @cristipufu and others