From 9fc80730f16112c59337a6c0c3fd008ea4cd242b Mon Sep 17 00:00:00 2001 From: Tobe O Date: Wed, 14 Aug 2019 16:10:52 -0400 Subject: [PATCH] rejectRequest never returns null --- lib/src/rate_limiter.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/rate_limiter.dart b/lib/src/rate_limiter.dart index 7ece0fa3..ea5a7d0f 100644 --- a/lib/src/rate_limiter.dart +++ b/lib/src/rate_limiter.dart @@ -133,7 +133,9 @@ abstract class RateLimiter { // user over the rate limit. else if (currentWindow.pointsConsumed > maxPointsPerWindow) { await sendWindowInformation(req, res, currentWindow); - return await rejectRequest(req, res, currentWindow, now); + var result = await rejectRequest(req, res, currentWindow, now); + if (result != null) return result; + return false; } else { // Add the cost of the current endpoint, and update the window. var cost = await getEndpointCost(req, res, currentWindow);