arcticfox1919 / arowana

A lightweight HTTP server framework for Dart.
MIT License
21 stars 3 forks source link

Internal Server Error #6

Open CoderWeiLee opened 7 months ago

CoderWeiLee commented 7 months ago

在Controller中处理Request时,似乎前面有await方法处理,就会返回这个服务器内部错误。 Future call(Request request) async { var method = request.method; print("method是$method"); if (method == "GET") { // var body = await request.body; // var json = body.json; var path = await request.url.path; switch (path) { case 'intranetIP': SharedPreferences prefs = await SharedPreferences.getInstance(); var ipv4 = prefs.get('ipv4') as String; print("ipv4是$ipv4"); if (ipv4 != null && ipv4.isNotEmpty) { print("返回ipv4地址"); return Response.ok("11"); }else { return Response.notFound('ip地址获取失败,请刷新重试'); }