如何使用 curl 或 postman 在一个请求中一起发送多部分数据和 json 数据
how to send multipart data and json data together in one request using curl or postman
我有一个情况,我必须保存 json 数据并在一个请求中上传文件。
这就是我在 spring
中的表现
public void profile (@RequestBody @Validated @Valid ProfileDTO profileDTO,
@RequestPart("file") @Valid MultipartFile file){
/// saving to db
}
现在如何使用 curl 和 postman 进行测试?
之后:
https://github.com/postmanlabs/postman-app-support/issues/1104
您还不能在 Postman 中执行此操作(Postman 开发人员正在开发此功能)。
其他用户将 json 数据作为文件发送,但这只是 Postman 中可用的解决方法。
我有一个情况,我必须保存 json 数据并在一个请求中上传文件。
这就是我在 spring
中的表现 public void profile (@RequestBody @Validated @Valid ProfileDTO profileDTO,
@RequestPart("file") @Valid MultipartFile file){
/// saving to db
}
现在如何使用 curl 和 postman 进行测试?
之后: https://github.com/postmanlabs/postman-app-support/issues/1104
您还不能在 Postman 中执行此操作(Postman 开发人员正在开发此功能)。
其他用户将 json 数据作为文件发送,但这只是 Postman 中可用的解决方法。