1

在 channel.dart 中,我的路由器配置如下所示。但我无法将内容类型设置为文本;

router.route('/login/[:value]').link(() {
  return new LoginController();
  //..contentType = ContentType.TEXT;
});

Than in my custom controller I pass the post request to Future (shown below)

    Future<RequestOrResponse> handle(Request request) async {
          String _xRequestValue = request.toString();

And I get this;

print(xRequestValue); // GET /login/Q101::49785:_:x (1530612696990)

I can print the value as shown above comment. I need to get Q101::49785::x part in request. My question is that how to capture post request in Aqueduct?

4

1 回答 1

0

这很简单;

if (request.path.variables.containsKey('value')) {
  _xRequestValue = (request.path.variables['value']).trim();


}
于 2018-07-03T11:15:40.120 回答