Open CoderWeiLee opened 11 months ago
监听运行在iphone上已经通过端口转发解决了,目前Get请求可以监听并且响应 但是Post请求一直报错 route not found
class TestChannel extends DefaultChannel {
handleRequest(Request request) async {
print("解析post请求中的参数...");
// 解析POST请求体中的参数
var body = await utf8.decodeStream(request.read());
var decodedBody = jsonDecode(body);
var name = decodedBody['name'];
var age = decodedBody['age'];
return Response.ok("name:$name, age:$age");
}
@override
Future prepare() {
print('current isolate [${Isolate.current.debugName}]');
return super.prepare();
}
@override
void entryPoint() {
post('/hello', (r) => handleRequest(r));
// // 分组路由
// var r = group('/info');
// get('/hello', (r) {
// return Response.ok('hello,arowana!');
// });
}
@CoderWeiLee
好的 我回头试一下 谢谢哈
我想电脑访问手机启动服务的接口 获得数据