Can't bind or directly access multipart/mixed request parts #34494
Labels
for: external-project
For an external project and not something we can fix
status: invalid
An issue that we don't feel is valid
I'm trying to create a controller that will consume
multipart/mixed
requests containing both a json string and a file. I have tried@RequestPart
,@RequestParam
and usingMultipartHttpServletRequest
directly, but binding doesn't happen andMultipartHttpServletRequest.getParts()
returns an empty collection. However, if the same controller consumes amultipart/form-data
request, all approaches work as expected.Issue #30971 mentioned something similar, but it's not the same case and using
MultipartHttpServletRequest
, as suggested there, doesn't help.Here's one example using
@RequestPart
:If I send the following request...
... the app will print:
But if
multipart/form-data
is used instead, it will work as expected:I'm using jdk11 and Spring Boot 2.7.9. The repo below has a minimal application to replicate the issue.
https://github.com/andrepnh/spring-multipart-mixed-bug
Please let me know if more information is needed.
The text was updated successfully, but these errors were encountered: