diff --git a/lib/src/rate_limiter.dart b/lib/src/rate_limiter.dart index 8ff3ead4..25977a97 100644 --- a/lib/src/rate_limiter.dart +++ b/lib/src/rate_limiter.dart @@ -81,5 +81,9 @@ abstract class RateLimiter { /// /// Whatever is returned here will be returned in [handleRequest]. FutureOr denyRequest(RequestContext req, ResponseContext res, - RateLimitingWindow window) {} + RateLimitingWindow window, DateTime currentTime) { + var retryAfter = window.resetsAt.difference(currentTime); + res.headers['retry-after'] = retryAfter.inSeconds.toString(); + throw AngelHttpException(null, message: errorMessage, statusCode: 429); + } }