Default rate limit message
This commit is contained in:
parent
9fc80730f1
commit
dafe005cb2
3 changed files with 8 additions and 2 deletions
|
@ -1,10 +1,15 @@
|
|||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:angel_framework/http.dart';
|
||||
import 'package:angel_security/angel_security.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:pretty_logging/pretty_logging.dart';
|
||||
|
||||
main() async {
|
||||
// Logging boilerplate.
|
||||
Logger.root.onRecord.listen(prettyLog);
|
||||
|
||||
// Create an app, and HTTP driver.
|
||||
var app = Angel(), http = AngelHttp(app);
|
||||
var app = Angel(logger: Logger('rate_limit')), http = AngelHttp(app);
|
||||
|
||||
// Create a simple in-memory rate limiter that limits users to 5
|
||||
// queries per hour.
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class RateLimiter<User> {
|
|||
final String errorMessage;
|
||||
|
||||
RateLimiter(this.maxPointsPerWindow, this.windowDuration,
|
||||
{this.errorMessage});
|
||||
{this.errorMessage = 'Rate limit exceeded.'});
|
||||
|
||||
/// Computes the current window in which the user is acting.
|
||||
///
|
||||
|
|
|
@ -12,4 +12,5 @@ dev_dependencies:
|
|||
angel_test: ^2.0.0
|
||||
angel_validate: ^2.0.0
|
||||
pedantic: ^1.0.0
|
||||
pretty_logging: ^1.0.0
|
||||
test: ^1.0.0
|
||||
|
|
Loading…
Reference in a new issue