- @override
Overridden by subclasses to modify or respond to an incoming request.
Subclasses override this method to provide their specific handling of a request.
If this method returns a Response
, it will be sent as the response for req
and req
will not be passed to any other controllers.
If this method returns req
, req
will be passed to nextController
.
If this method returns null, req
is not passed to any other controller and is not responded to. You must respond to req
through Request.innerRequest
.
Source
@override FutureOr<RequestOrResponse> processRequest(Request req) { var header = req.innerRequest.headers.value(HttpHeaders.AUTHORIZATION); if (header == null) { return new Response.unauthorized(); } switch (strategy) { case AuthStrategy.bearer: return _processBearerHeader(req, header); case AuthStrategy.basic: return _processBasicHeader(req, header); default: return new Response.serverError(); } }