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

Pass more info for customization to throwThrottlingException() #894

Closed
1 task done
iliazeus opened this issue Mar 30, 2022 · 2 comments · Fixed by #1565
Closed
1 task done

Pass more info for customization to throwThrottlingException() #894

iliazeus opened this issue Mar 30, 2022 · 2 comments · Fixed by #1565

Comments

@iliazeus
Copy link

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

It would be nice to have an ability to pass retry-after values and limits in the response body. Right now, the only ways to do that in the ThrottlerGuard subclasses are:

  • to parse the headers from the response object in throwThrottlingException()
  • to reimplement throttling logic in handleRequest()

Describe the solution you'd like

Pass an additional argument to throwThrottlingException() that would contain the nearestExpiryTime (and, ideally, the current request limit, and number of requests remaining).

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

An SMS/email code endpoint for authorization needs to allow no more than one request per IP+account per minute. The client app needs to show a countdown. Parsing headers in the client app is cumbersome.

@jmcdo29
Copy link
Member

jmcdo29 commented Mar 30, 2022

This seems rather straightforward. Would you like to create a PR for this?

@jmcdo29
Copy link
Member

jmcdo29 commented Jul 6, 2023

Added to #1565 will be a part of the 5.0.0 release

@jmcdo29 jmcdo29 linked a pull request Jul 6, 2023 that will close this issue
12 tasks
@jmcdo29 jmcdo29 mentioned this issue Jul 6, 2023
12 tasks
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 a pull request may close this issue.

2 participants