【发布时间】:2022-09-28 19:41:53
【问题描述】:
我定义了一个端点来接受multipart/form-data 文件,如下所示:
@Post(\'/...\')
@SuccessResponse(202, \'Accepted\')
@Response(400, \'Bad request\')
@Response(404, \'Not found\')
public async acceptFile(
@UploadedFile(\'file\') file: Express.Multer.File
): Promise<...> {
return this.fileService.acceptFile(file);
}
当我发送一个带有文件参数的multipart/form-data 请求时,TSOA 不接受这个请求,声称\"\'file\' is required\"。即使我提供了它:
如您所见,请求是由 Postman 创建的,是正确的并且具有 file 表单数据参数。根据TSOA file upload documentation,这应该可行。
标签: typescript postman tsoa