-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
feat: allow arbitrary fields in MultipartFormFiles #706
base: main
Are you sure you want to change the base?
feat: allow arbitrary fields in MultipartFormFiles #706
Conversation
85801d2
to
14b6613
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #706 +/- ##
==========================================
- Coverage 92.90% 92.84% -0.07%
==========================================
Files 22 22
Lines 4963 5014 +51
==========================================
+ Hits 4611 4655 +44
- Misses 305 309 +4
- Partials 47 50 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
formdata.go:125
- Potential nil pointer dereference. Check if formValueParser is nil before calling it.
formValueParser(value)
formdata.go:178
- [nitpick] Error message 'Failed to open file' is not descriptive. Consider including more context about the failure.
return FormFile{}, &ErrorDetail{Message: "Failed to open file", Location: location}
@b-kamphorst I think this looks good. Do you mind adding some additional user-facing documentation for form handling and the new feature? Thanks! |
Thank you for the initial review. I will update on the documentation shortly. Question: is it acceptable that only struct fields with a |
Oh and I appreciate your merging effort :) |
@danielgtaylor I think this extention to the docs suffices, but please let me know what you think. |
@danielgtaylor I started working on #694. The first part of the work is a major refactoring that I submitted separately in #705. The second part is a feature where MultipartFormFiles also parses and validates multipart.Form.Value into the input struct. The diff is probably clearer in this PR.
At time of writing, the added feature only parses fields that have a
form
tag, mostly because I copied the approach for parsing and validating other request parameters and I was not quite sure how to do that differently. Before I continue, I would much like to hear your thoughts:Closes #694.