create handle request
This commit is contained in:
parent
dead3663f0
commit
0e7d47e107
1 changed files with 9 additions and 0 deletions
|
@ -86,4 +86,13 @@ abstract class RateLimiter<User> {
|
||||||
res.headers['retry-after'] = retryAfter.inSeconds.toString();
|
res.headers['retry-after'] = retryAfter.inSeconds.toString();
|
||||||
throw AngelHttpException(null, message: errorMessage, statusCode: 429);
|
throw AngelHttpException(null, message: errorMessage, statusCode: 429);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A request middleware that returns `true` if the user has not yet
|
||||||
|
/// exceeded the [maxPointsPerWindow].
|
||||||
|
///
|
||||||
|
/// Because this handler is typically called *before* business logic is
|
||||||
|
/// executed, it technically checks whether the *previous* call raised the
|
||||||
|
/// number of consumed points to greater than, or equal to, the
|
||||||
|
/// [maxPointsPerWindow].
|
||||||
|
Future handleRequest(RequestContext req, ResponseContext res) async {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue