Add body methods with Object parameter to WebFlux
The commit deprecates syncBody(Object) in favor of body(Object) which has the same behavior in ServerResponse, WebClient and WebTestClient. It also adds body(Object, Class) and body(Object, ParameterizedTypeReference) methods in order to support any reactive type that can be adapted to a Publisher via ReactiveAdapterRegistry. Related BodyInserters#fromProducer methods are provided as well. Shadowed Kotlin body<T>() extensions are deprecated in favor of bodyWithType<T>() ones, including dedicated Publisher<T> and Flow<T> variants. Coroutines extensions are adapted as well, and body(Object) can now be used with suspending functions. Closes gh-23212
This commit is contained in:
@@ -41,7 +41,7 @@ import org.springframework.util.MultiValueMap;
|
||||
/**
|
||||
* Builder for the body of a multipart request, producing
|
||||
* {@code MultiValueMap<String, HttpEntity>}, which can be provided to the
|
||||
* {@code WebClient} through the {@code syncBody} method.
|
||||
* {@code WebClient} through the {@code body} method.
|
||||
*
|
||||
* Examples:
|
||||
* <pre class="code">
|
||||
@@ -67,7 +67,7 @@ import org.springframework.util.MultiValueMap;
|
||||
*
|
||||
* Mono<Void> result = webClient.post()
|
||||
* .uri("...")
|
||||
* .syncBody(multipartBody)
|
||||
* .body(multipartBody)
|
||||
* .retrieve()
|
||||
* .bodyToMono(Void.class)
|
||||
* </pre>
|
||||
|
||||
Reference in New Issue
Block a user