解决feign实现微服务间的文件上传出现错误the request was rejected because no multipart boundary was found

项目最开始的依赖

io.github.openfeign.form
feign-form
3.0.3


io.github.openfeign.form
feign-form-spring
3.0.3


commons-fileupload
commons-fileupload
1.3.3

跟踪源码发现content-type会被","或";"进行转换为Map,跟踪代码为org.apache.tomcat.util.http.fileupload.FileUploadBase#getBoundary

截图


20191217012606545.png

在org.apache.tomcat.util.http.fileupload.FileUploadBase.FileItemIteratorImpl#FileItemIteratorImpl抛出异常


2019121701274175.png

请求头中内容为

//用户所调用的接口提交的content-type
multipart/form-data; boundary=--------------------------381278542566024683689443
//经过feign转发请求后的content-type,按英文逗号拆分刚好Map没有boundary为key的值,索引报错
multipart/form-data, multipart/form-data; charset=UTF-8; boundary=16f0f6d2c45

解决方法为修改feign-form的版本

io.github.openfeign.form
feign-form-spring
3.6.0


io.github.openfeign.form
feign-form
3.6.0


commons-fileupload
commons-fileupload
1.3.3

转载自:https://blog.csdn.net/wqj975005563/article/details/103572705
原文链接:https://blog.csdn.net/wqj975005563/article/details/103572705

你可能感兴趣的:(解决feign实现微服务间的文件上传出现错误the request was rejected because no multipart boundary was found)