Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信公众号,素材上传经过Java写的代理服务器出现:the request was rejected because no multipart boundary was found #3273

Closed
Minhat-GitHub opened this issue May 7, 2024 · 2 comments · Fixed by #3282

Comments

@Minhat-GitHub
Copy link

Minhat-GitHub commented May 7, 2024

简要描述

微信公众号,素材上传如果直接传给微信可以成功;如果走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());就可以请求成功

模块版本情况

  • WxJava 模块名:weixin-java-mp
  • WxJava 版本号:4.6.0

详细描述

Java异常截图
image

tomcat内部的代码
image

@0katekate0
Copy link
Member

欢迎提交pr

@ChenJiaXin520
Copy link

欢迎提交pr

pr已提交:#3282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants