Pass more info for customization to throwThrottlingException()
iliazeus opened this issue · 2 comments
iliazeus commented
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 commented
This seems rather straightforward. Would you like to create a PR for this?