call method

  1. @override
FutureOr<Response> Function(Request) call(
  1. Handler handler, [
  2. ModularRoute? route
])
override

Implementation

@override
FutureOr<shelf.Response> Function(shelf.Request) call(shelf.Handler handler,
    [ModularRoute? route]) {
  return (request) async {
    if (!await canActivate(request, route as Route)) {
      return shelf.Response.forbidden(
          jsonEncode({'error': route.uri.toString().trim()}));
    }
    return handler(request);
  };
}