feat(ghttp): 支持文件上传字段的嵌套结构解析 #4234
Open
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.
当前问题,使用嵌套字段时无法自动绑定到嵌套字段的文件 【已解决】
使用 multipart/form-data 上传时
【问题描述】
之前使用:
获得的结果是扁平化的:
由于没有将
map["data[file]"]以map["data"]["file"]的形式存储,导致最终进行r.Parse时无法将文件正确绑定到结构体字段:这些字段无论如何都是 nil。
【解决方案】
现在已修复此问题,通过解析嵌套的字段名并构建正确的嵌套Map结构。修复后,
GetRequestMap()返回的结果如下:这样,嵌套结构中的文件字段现在可以正确绑定到相应的结构体字段了。这一修复实现了对表单中嵌套文件字段的完整支持。
Please ensure you adhere to every item in this list.
<type>[optional scope]: <description>For example,fix(os/gtime): fix time zone issue<type>is mandatory and can be one offix,feat,build,ci,docs,style,refactor,perf,test,chorefix: Used when a bug has been fixed.feat: Used when a new feature has been added.build: Used for modifications to the project build system, such as changes to dependencies, external interfaces, or upgrading Node version.ci: Used for modifications to continuous integration processes, such as changes to Travis, Jenkins workflow configurations.docs: Used for modifications to documentation, such as changes to README files, API documentation, etc.style: Used for changes to code style, such as adjustments to indentation, spaces, blank lines, etc.refactor: Used for code refactoring, such as changes to code structure, variable names, function names, without altering functionality.perf: Used for performance optimization, such as improving code performance, reducing memory usage, etc.test: Used for modifications to test cases, such as adding, deleting, or modifying test cases for code.chore: Used for modifications to non-business-related code, such as changes to build processes or tool configurations.<type>, specify the affected package name or scope in parentheses, for example,(os/gtime).Fixes #1234orUpdates #1234(the latter if this is not a complete fix) to this comment
提交前请遵守每个事项,感谢!
<类型>[可选 范围]: <描述>例如fix(os/gtime): fix time zone issue<类型>是必须的,可以是fix、feat、build、ci、docs、style、refactor、perf、test、chore中的一个<类型>后在括号中填写受影响的包名或范围,例如(os/gtime)Fixes #1234,如果不是完全修复则添加Updates #1234