public static interface WebTestClient.RequestBodySpec extends WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
| Modifier and Type | Method and Description |
|---|---|
WebTestClient.RequestHeadersSpec<?> |
body(BodyInserter<?,? super ClientHttpRequest> inserter)
Set the body of the request to the given
BodyInserter. |
WebTestClient.RequestHeadersSpec<?> |
body(Object producer,
Class<?> elementClass)
Set the body from the given producer.
|
WebTestClient.RequestHeadersSpec<?> |
body(Object producer,
ParameterizedTypeReference<?> elementTypeRef)
Set the body from the given producer.
|
<T,S extends Publisher<T>> |
body(S publisher,
Class<T> elementClass)
Set the body from the given
Publisher. |
<T,S extends Publisher<T>> |
body(S publisher,
ParameterizedTypeReference<T> elementTypeRef)
Variant of
body(Publisher, Class) that allows providing
element type information with generics. |
WebTestClient.RequestHeadersSpec<?> |
bodyValue(Object body)
Set the body to the given
Object value. |
WebTestClient.RequestBodySpec |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
WebTestClient.RequestBodySpec |
contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
WebTestClient.RequestHeadersSpec<?> |
syncBody(Object body)
Deprecated.
as of Spring Framework 5.2 in favor of
bodyValue(Object) |
accept, acceptCharset, attribute, attributes, cookie, cookies, exchange, header, headers, ifModifiedSince, ifNoneMatchWebTestClient.RequestBodySpec contentLength(long contentLength)
Content-Length header.contentLength - the content lengthHttpHeaders.setContentLength(long)WebTestClient.RequestBodySpec contentType(MediaType contentType)
Content-Type header.contentType - the content typeHttpHeaders.setContentType(MediaType)WebTestClient.RequestHeadersSpec<?> bodyValue(Object body)
Object value. This method invokes the
bodyValue method on the underlying WebClient.body - the value to write to the request body<T,S extends Publisher<T>> WebTestClient.RequestHeadersSpec<?> body(S publisher, Class<T> elementClass)
T - the type of the elements contained in the publisherS - the type of the Publisherpublisher - the request body dataelementClass - the class of elements contained in the publisher<T,S extends Publisher<T>> WebTestClient.RequestHeadersSpec<?> body(S publisher, ParameterizedTypeReference<T> elementTypeRef)
body(Publisher, Class) that allows providing
element type information with generics.T - the type of the elements contained in the publisherS - the type of the Publisherpublisher - the request body dataelementTypeRef - the type reference of elements contained in the publisherWebTestClient.RequestHeadersSpec<?> body(Object producer, Class<?> elementClass)
body(Object, Class) method on the underlying WebClient.producer - the producer to write to the request. This must be a
Publisher or another producer adaptable to a
Publisher via ReactiveAdapterRegistryelementClass - the class of elements contained in the producerWebTestClient.RequestHeadersSpec<?> body(Object producer, ParameterizedTypeReference<?> elementTypeRef)
body(Object, ParameterizedTypeReference) method on the underlying WebClient.producer - the producer to write to the request. This must be a
Publisher or another producer adaptable to a
Publisher via ReactiveAdapterRegistryelementTypeRef - the type reference of elements contained in the producerWebTestClient.RequestHeadersSpec<?> body(BodyInserter<?,? super ClientHttpRequest> inserter)
BodyInserter.
This method invokes the
body(BodyInserter) method on the underlying WebClient.inserter - the body inserter to useBodyInserters@Deprecated WebTestClient.RequestHeadersSpec<?> syncBody(Object body)
bodyValue(Object)body(BodyInserter) with a
value inserter.
As of 5.2 this method delegates to bodyValue(Object).