在用postman 请求这个调用接口的时候,报了the request was rejected because no multipart boundary was found
1.首先检查是否导入了下面两个包
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form-spring</artifactId>
<version>3.2.2</version>
</dependency>
2.再检查一下feign接口是否有如下参数
/**
* 上传文件
*
* @param file 文件信息
* @return 结果
*/
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
重点
请求体必须是@RequestPart这个注解,
并且consumes=MediaType.MULTIPART_FORM_DATA_VALUE
原因
因为源码里面content-type会被",“或”;"进行转换为Map,在org.apache.tomcat.util.http.fileupload.FileUploadBase.FileItemIteratorImpl#FileItemIteratorImpl抛出异常,所以大家一定要注意jar包版本问题。