-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Changed the Rate Limiter API to action-based #41657
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
Conversation
src/Middleware/RateLimiting/src/RateLimitingApplicationBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Weihan Li <[email protected]>
@@ -29,11 +29,14 @@ public static IApplicationBuilder UseRateLimiter(this IApplicationBuilder app) | |||
/// <param name="app"></param> | |||
/// <param name="options"></param> | |||
/// <returns></returns> | |||
public static IApplicationBuilder UseRateLimiter(this IApplicationBuilder app, RateLimiterOptions options) | |||
public static IApplicationBuilder UseRateLimiter(this IApplicationBuilder app, Action<RateLimiterOptions> options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This'd probably be called configure
now rather than options
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I missed this. configure
seems to be the common naming convention for this so I'll change it. Currently pending on some back and forth in #41655 regarding whether this overload is needed or not. Once that's settled I'll update it with the latest changes
@Elfocrash Thanks for submitting this issue and PR. Based on the discussion in #41655 it looks like we should wait for #41667 which will make this middleware endpoint-aware. Once that's done, we'll have an API where this type of action will fit in. For now, I think we should close this PR. |
Changed the Rate Limiter API to action-based
Description
The most common approach when it comes to configuring options/settings in AddXXX, UseXXX and MapXXX methods during project setup is to use the Action-based approach.
UseRateLimiter
doesn't follow that approach. This PR addresses that by allowing people to do:Fixes #41655