Merged
Conversation
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix upload method to include JSON data in video uploads
支持upload方法在上传文件时添加额外表单字段
Jan 19, 2026
🤖 Augment PR SummarySummary: 本 PR 为通用上传能力补充“额外表单字段”支持,用于解决公众号上传永久视频素材时需同时提交文件与
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Pull request overview
此 PR 扩展了 CommonUploadParam 类以支持在文件上传时添加额外的表单字段,主要解决微信公众号上传永久视频素材时需要同时提交 description 字段的需求。
Changes:
- 在
CommonUploadParam类中添加可选的formFields属性(Map<String, String>) - 新增
addFormField()方法支持链式调用添加表单字段 - 更新所有 4 个 HTTP 客户端执行器实现以支持额外表单字段
- 添加完整的单元测试和使用文档
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/CommonUploadParam.java |
核心类变更:添加 formFields 属性和 addFormField() 方法 |
weixin-java-common/src/main/java/me/chanjar/weixin/common/executor/CommonUploadRequestExecutorOkHttpImpl.java |
OkHttp 执行器:实现额外表单字段支持 |
weixin-java-common/src/main/java/me/chanjar/weixin/common/executor/CommonUploadRequestExecutorApacheImpl.java |
Apache HttpClient 执行器:实现额外表单字段支持 |
weixin-java-common/src/main/java/me/chanjar/weixin/common/executor/CommonUploadRequestExecutorHttpComponentsImpl.java |
HttpComponents 执行器:实现额外表单字段支持 |
weixin-java-common/src/main/java/me/chanjar/weixin/common/executor/CommonUploadRequestExecutorJoddHttpImpl.java |
JoddHttp 执行器:实现额外表单字段支持 |
weixin-java-common/src/test/java/me/chanjar/weixin/common/bean/CommonUploadParamTest.java |
新增单元测试覆盖所有新功能和边界情况 |
weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaAuthServiceImpl.java |
适配 CommonUploadParam 构造函数变更 |
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenUploadIcpMediaParam.java |
适配 CommonUploadParam 构造函数变更 |
docs/CommonUploadParam-FormFields-Usage.md |
新增详细的使用文档和示例 |
weixin-java-common/src/main/java/me/chanjar/weixin/common/bean/CommonUploadParam.java
Show resolved
Hide resolved
weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaAuthServiceImpl.java
Outdated
Show resolved
Hide resolved
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenUploadIcpMediaParam.java
Outdated
Show resolved
Hide resolved
…/CommonUploadParam.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Owner
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Contributor
Author
已完成修改(提交 d49b930)。 根据review建议,已将 现有代码可以继续使用 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
任务完成总结
本PR成功解决了公众号模块
upload方法不能在上传文件的同时添加额外表单JSON数据的问题。完成的工作
CommonUploadParam和相关执行器CommonUploadParam类,添加额外表单字段支持主要变更
核心功能扩展:
CommonUploadParam类新增formFields属性和addFormField()方法HTTP客户端支持:
测试覆盖:
CommonUploadParamTest.java文档完善:
向后兼容性
@Deprecated标注的2参数构造函数CommonUploadParam(String name, CommonUploadData data)fromFile()或fromBytes(),或使用3参数构造函数使用示例
上传永久视频素材(带描述信息):
验证结果
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.