I have two controllers, one resource, the other normal. They are in the same thread and both must run.
I deliberately inserted a sudden return in a normal controller to make sure it was simply ignored.
Regular controller:
import 'package:aqueduct/aqueduct.dart';
import 'package:app_server/app_server.dart';
class InputController extends Controller {
@override
Future<RequestOrResponse> handle(Request request) async {
return Response.badRequest();
}
}
Channel:
@override
Controller get entryPoint {
final router = Router();
router.route("/auth/[:type]")
..link(() => InputController())
..link(() => AuthorizationController(context));
return router;
}
The channel skips the InputController, and immediately proceeds to the resource controller (AuthorizationController).
In fact it does not skip the
InputController
(you can printf inside if you want to belive :) ), but it works on the object returned byrouter.route("/auth/[:type]")
instead of on the result ofInputController
.In other words, your channel can be written as below:
Change cascade notation to a normal chain in the channel in order to resolve tour problem: