-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Description
Andy Wilkinson opened SPR-16118 and commented
I'm enjoying the more fluent nature of WebTestClient
when compared with MockMvc
, but have found that sending a request with form or multipart data body jars a bit. The main problem is that, as far as I can tell, I have to create a MultiValueMap
for the data separately and then use BodyInserters.fromMultipartData
or BodyInserters.fromFormData
, for example:
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
formData.add("username", "Tester");
this.webTestClient.post().uri("/users").body(BodyInserters.fromFormData(formData))
I'd like to be able to do something like this instead:
this.webTestClient.post().uri("/users").body(BodyInserters.formData().param("username", "Tester"))
Affects: 5.0.1
Sub-tasks:
- Chained API for form and multipart data in BodyInserters [SPR-16133] #20681 Chained API for form and multipart data in BodyInserters
- Create builder for multipart bodies [SPR-16134] #20682 Create builder for multipart bodies
Issue Links:
- Multipart form data can no longer be sent with syncBody in WebTestClient [SPR-16131] #20679 Multipart form data can no longer be sent with syncBody in WebTestClient
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement