Closed Minhat-GitHub closed 3 months ago
微信公众号,素材上传如果直接传给微信可以成功;如果走Java写的Controller代理服务器会出现: the request was rejected because no multipart boundary was found
the request was rejected because no multipart boundary was found
经过排查是因为: MaterialUploadApacheHttpRequestExecutor.execute()方法中63行: httpPost.setHeader("Content-Type", ContentType.MULTIPART_FORM_DATA.toString());
httpPost.setHeader("Content-Type", ContentType.MULTIPART_FORM_DATA.toString());
因为Tomcat处理上传文件时需要请头Content-Type为multipart/form-data; boundary=--------------------------242815868904497413282610
multipart/form-data; boundary=--------------------------242815868904497413282610
但是MaterialUploadApacheHttpRequestExecutor实际发出的请求Content-Type为multipart/form-data; charset=ISO-8859-1
multipart/form-data; charset=ISO-8859-1
自己写代码测试去掉httpPost.setHeader("Content-Type", ContentType.MULTIPART_FORM_DATA.toString());就可以请求成功
Java异常截图
tomcat内部的代码
欢迎提交pr
pr已提交:https://github.com/Wechat-Group/WxJava/pull/3282
简要描述
微信公众号,素材上传如果直接传给微信可以成功;如果走Java写的Controller代理服务器会出现:
the request was rejected because no multipart boundary was found
经过排查是因为: MaterialUploadApacheHttpRequestExecutor.execute()方法中63行:
httpPost.setHeader("Content-Type", ContentType.MULTIPART_FORM_DATA.toString());
因为Tomcat处理上传文件时需要请头Content-Type为
multipart/form-data; boundary=--------------------------242815868904497413282610
但是MaterialUploadApacheHttpRequestExecutor实际发出的请求Content-Type为
multipart/form-data; charset=ISO-8859-1
自己写代码测试去掉
httpPost.setHeader("Content-Type", ContentType.MULTIPART_FORM_DATA.toString());
就可以请求成功模块版本情况
详细描述
Java异常截图![image](https://github.com/Wechat-Group/WxJava/assets/35595109/0222f02d-0913-4b98-972d-72074c6b78af)
tomcat内部的代码![image](https://github.com/Wechat-Group/WxJava/assets/35595109/6d4f031f-89c1-4b3a-bf33-c21f771b1d2e)