You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Path("widgets4")
public class WidgetsResource4 {
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response postWidget(@FormParam("part1Name") String part1,
@FormParam("part2Name") InputStream part2,
@FormParam("part3Name") EntityPart part3) {...}
}
@FormParam represents a part of a Multipart request, not a QueryValue. But, here, the code is translating it to @QueryValue - this is wrong and will break HTTP clients.
Actual Behaviour
The above snippet should work correctly, with the @FormParam values being interpreted as part of the multipart form, not as query parameters.
Steps To Reproduce
Write a JAX-RS controller which uses @FormParam to indicate multipart form data
Test, it will break
Environment Information
No response
Example Application
I cannot provide a sample application right now as this was noticed in an enterprise setting.
Version
4.4.0
The text was updated successfully, but these errors were encountered:
graemerocher
changed the title
Multipart/form-data not working correctly
Add support for multipart and @FormParam annotation
Jun 28, 2024
Micronaut is not currently a JAX-RS implementation, the annotations are designed to aid in porting code from JAX-RS. We are currently working to see if greater compatibility can be achieved but currently @FormParam is not supported and this should be a compilation error.
Micronaut is not currently a JAX-RS implementation, the annotations are designed to aid in porting code from JAX-RS. We are currently working to see if greater compatibility can be achieved but currently @FormParam is not supported and this should be a compilation error.
That's unfortunate that isn't supported. I couldn't find docs which specify how Multipart endpoints should be handled using this library, is it the List<EntityPart> approach?
(Also, are there other libraries that work as JAX-RS implementations for Micronaut? This was the only one that I can find that even related to JAX-RS)
Expected Behavior
@FormParam
should not be transposed to@QueryValue
in a multipart endpoint.As per https://jakarta.ee/specifications/restful-ws/3.1/jakarta-restful-ws-spec-3.1.html#consuming_multipart_formdata:
@FormParam
represents a part of a Multipart request, not aQueryValue
. But, here, the code is translating it to@QueryValue
- this is wrong and will break HTTP clients.Actual Behaviour
The above snippet should work correctly, with the
@FormParam
values being interpreted as part of the multipart form, not as query parameters.Steps To Reproduce
@FormParam
to indicate multipart form dataEnvironment Information
No response
Example Application
I cannot provide a sample application right now as this was noticed in an enterprise setting.
Version
4.4.0
The text was updated successfully, but these errors were encountered: