-
Notifications
You must be signed in to change notification settings - Fork 56
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(controller): support receiving MultipartFile
s
#3165
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3165 +/- ##
=======================================
Coverage 92.89% 92.89%
=======================================
Files 85 85
Lines 3334 3334
Branches 801 801
=======================================
Hits 3097 3097
Misses 184 184
Partials 53 53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
MultipartFile
s to objectsMultipartFile
s to objects
To be clear, this also works for top-level parameters: public String uploadAvatar(String user, MultipartFile file) {
return String.format("The avatar for %s is %d bytes.\n", user, file.getSize());
} Request follows:
|
MultipartFile
s to objectsMultipartFile
s
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.
Looks good!
Just suggested another test for verifying the possibility of handling multiple files as endpoint's params.
assertEquals(HttpStatus.OK, response.getStatusCode()); | ||
assertTrue(response.getBody().contains("Check John's file length OK")); | ||
} | ||
|
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.
I suggest adding another test that verifies having multiple files as endpoint's params also works.
Quality Gate passedIssues Measures |
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.
LGTM!
Enhances extension compatibility with file upload changes from vaadin/hilla#3165. Updates EndpointController to utilize a custom HttpServletRequest, ensuring seamless integration with Quarkus Multipart Form data handling.
Enhances extension compatibility with file upload changes from vaadin/hilla#3165. Updates EndpointController to utilize a custom HttpServletRequest, ensuring seamless integration with Quarkus Multipart Form data handling.
Enhances extension compatibility with file upload changes from vaadin/hilla#3165. Updates EndpointController to utilize a custom HttpServletRequest, ensuring seamless integration with Quarkus Multipart Form data handling.
Multipart requests are supposed to contain some files (with name) and one JSON part named "hilla_body_part", which contains the ordinary data.
The part names for files must be named according to the JSON syntax for accessing a JSON object. So, for example, if a method has a parameter named
uploadedFile
, the corresponding path will be/uploadedFile
. But paths can also point anywhere in the object, like/orders/1/invoice
.Closes #3130