测试 egg 框架, header query 均正常获取到,不知道 body 为什么没有获取到,请帮忙查看一下
执行方法比较简单,就是简单的打印一下
async create() {
const { ctx, service } = this;
// let res = await service.home.index();
// console.log(res);
let payload = ctx.request;
console.log(payload);
ctx.body = {
msg: "创建成功"
}
}
结果如下:
method: 'POST',
url: '/api/user',
header: {
accept: '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN',
'user-agent': 'ApiPOST Runtime +https://www.apipost.cn',
connection: 'keep-alive',
origin: 'http://127.0.0.1:7001',
test: 'test',
'content-type': 'multipart/form-data; boundary=--------------------------922302154919583337098517',
cookie: 'csrfToken=VSxqVdGq2Uh50C__QU5P0mPa',
host: '127.0.0.1:7001',
'content-length': '390'
}
请加QQ:2184785786看一下