From fe4ffc20a9bb73b81926f62b33cf8a41396e4ce6 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 14 Aug 2019 15:24:35 -0400 Subject: [PATCH] denyRequest docs --- lib/src/rate_limiter.dart | 9 +++++++++ 1 file changed, 9 insertions(+) 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) {} }