midway
midway copied to clipboard
[Question]@Body如果遇到客户端有某个值没传,后面的参数全部会变成所有数据对象
背景
@Post('/daily/sync')
async dailySync(
@Body() userId: number,
@Body() date: string,
@Body() actId: number,
@Body() test: string
) {
console.log(userId, date, actId, test);
}
如果我传递
{
userId: 1,
actId: 1,
}
则结果会变成
1, undefied, { userId: 9, actId: 1 }, { userId: 9, actId: 1 }

应该修复了吧
还是 @Body(ALL) 比较好,还方便用 interface 做参数类型校验
还是
@Body(ALL)比较好,还方便用 interface 做参数类型校验
是的
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.