diff --git a/lib/src/rate_limiter.dart b/lib/src/rate_limiter.dart index 75d4b99a..e7bba885 100644 --- a/lib/src/rate_limiter.dart +++ b/lib/src/rate_limiter.dart @@ -52,6 +52,15 @@ abstract class RateLimiter { return Future.value(1); } + /// Signals to a user that they have exceeded the rate limit for the + /// current window. + /// + /// The default implementation is throw an [AngelHttpException] with + /// status code `429` and the given `errorMessage`, as well as sending + /// a [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) + /// header, and then returning `false`. + /// + /// Whatever is returned here will be returned in [handleRequest]. FutureOr denyRequest(RequestContext req, ResponseContext res, RateLimitingWindow window) {} }