Closed NielsCW closed 4 months ago
Note there are 2 parameters appended to the Content-Type
, which are not covered by spring-content mockmvc-based tests:
boundary=...
is appended by (any) httpclient, mockmvc does not, because it operates at a higher abstraction levelcharset=UTF-8
is automatically appended by OrderedCharacterEncodingFilter
(via HttpEncodingAutoConfiguration
) in an auto-configuration scenario, but is not loaded via MockMvcBuilders.webAppContextSetup(context).build()
Describe the bug Performing a
multipart/form-data
request to the endpoint to create entity and content in single request fails with400 Bad Request
To Reproduce
http --print HhBb --form <url> foo=bar content@test.txt
400 Bad Request
The application fails at this line because the
Content-Type
header has valuemultipart/form-data;boundary=8c...37;charset=UTF-8
Expected behavior Succeeding to create entity with a
201 Created