Repository navigation
Snippets for a multipart request documented with WebTestClient include both the raw body and the parts - #1093
Open
chuuminggg wants to merge 1 commit into
Conversation
Previously, a multipart request documented with WebTestClient had both its raw body and its parts. This produced curl and HTTPie snippets that could not be run and an HTTP request snippet with two boundaries. The request is now created without content and without the boundary, as is done for MockMvc. Fixes spring-projectsgh-1075 Signed-off-by: chuuminggg <rorrxr@naver.com>
chuuminggg
force-pushed
the
gh-1075-webtestclient-multipart
branch
from
November 16, 2026 13:44
342e4a0 to
f6900c2
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes gh-1075
This goes with the first option from the issue. When the request's parts can be read,
WebTestClientRequestConverternow creates the request without content and removes the boundary from theContent-Typeheader, so it looks like the request thatMockMvcRequestConvertercreates. The snippets themselves aren't changed. If the body can't be read as parts, the request is left as it was.With this change, the existing
multipart()integration test produces a curl snippet with only the-Foptions, an HTTPie snippet without the piped body, and an HTTP request snippet with a single boundary. I've updated the test to check all three, and I ran the curl command against a local server to make sure that curl accepts it and sends both parts.RestTestClientRequestConverterinmainhas the same problem. I haven't touched it here, but I can open a separate PR for it if you'd like.