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

Add three kinds of limit counter mode, and two kinds of response mode for quota exceeded response. #492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chaosact
Copy link

1.RateLimitRule adds the ConterKeyMode property. Below is the effect of its value.
Let's say the EndPoint is set to *:/api/values
VerbAndPath (default, compatible with older versions) - GET:/api/values/1 and POST:/api/values/1, GET:/api/values/2 and POST:/api/values/2 will be counted separately.
Path-GET :/api/values and POST:/api/values will be combined and counted
VerbAndRule-GET :/api/values/1 POST:/api/values/2 will be counted separately, but GET:/api/values/1 and GET:/api/values/2 will be counted together.
Rule-GET :/api/values/1, POST:/api/values/1, GET:/api/values/2, POST:/api/values/2 will all be concatenated.
2. Increase ResponseType QuotaExceededResponse, Controller, Action, Url attribute. Depending on the value of ResponseType, different properties are used to respond to different outputs.
WriteContent (default, older compatible) - StatusCode writes Content to the response stream based on ContentType.
RedirectToAction (must set IApplicationBuilder UseRouting(), IApplicationBuilder. UseEndpoints() first) - redirects to the specified Controller. The Action. QuotaExceededParams quotaExceededParams can be obtained from the parameters to output the results with a more customized response.
RedirectToUrl - Redirects to the specified Url. Low custom response, cannot get QuotaExceededParams quotaExceededParams. Suitable for developers who just need to beautification their pages.
3. Add relevant unit tests.

…of its value.

Let's say the EndPoint is set to *:/api/values
VerbAndPath (default, compatible with older versions) - GET:/api/values/1 and POST:/api/values/1, GET:/api/values/2 and POST:/api/values/2 will be counted separately.
Path-GET :/api/values and POST:/api/values will be combined and counted
VerbAndRule-GET :/api/values/1 POST:/api/values/2 will be counted separately, but GET:/api/values/1 and GET:/api/values/2 will be counted together.
Rule-GET :/api/values/1, POST:/api/values/1, GET:/api/values/2, POST:/api/values/2 will all be concatenated.
2. Increase ResponseType QuotaExceededResponse, Controller, Action, Url attribute. Depending on the value of ResponseType, different properties are used to respond to different outputs.
WriteContent (default, older compatible) - StatusCode writes Content to the response stream based on ContentType.
RedirectToAction (must set IApplicationBuilder UseRouting(), IApplicationBuilder. UseEndpoints() first) - redirects to the specified Controller. The Action. QuotaExceededParams quotaExceededParams can be obtained from the parameters to output the results with a more customized response.
RedirectToUrl - Redirects to the specified Url. Low custom response, cannot get QuotaExceededParams quotaExceededParams. Suitable for developers who just need to beautification their pages.
3. Add relevant unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant