Default rate limit message

This commit is contained in:
Tobe O 2019-08-14 16:13:37 -04:00
parent 9fc80730f1
commit dafe005cb2
3 changed files with 8 additions and 2 deletions

View file

@ -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.

View file

@ -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.
///

View file

@ -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