Spring Boot Rest总是收到@RequestParam为空

时间:2019-05-28 12:31:09

标签: spring rest spring-boot

spring boot rest总是收到@RequestParam作为空值。

例如:

 @RequestParam(name = "param", required = false) String param,
 @RequestParam(name = "file", required = false) MultipartFile file) 

浏览器能够在表单数据下看到以下两个参数

file: (binary)
param: {"name:"test"}

也使用此consumes = MediaType.MULTIPART_FORM_DATA_VALUE

这就是我发送的邮件

formdata = new FormData(); 
formdata.append("file", file); 
formdata.append("param", obj);
return this.httpClient.post(encodeURI(${this.URL}), formdata, options)

0 个答案:

没有答案