Interface WebTestClient.RequestBodySpec
- All Superinterfaces:
- WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
- All Known Subinterfaces:
- WebTestClient.RequestBodyUriSpec
- Enclosing interface:
- WebTestClient
public static interface WebTestClient.RequestBodySpec
extends WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
Specification for providing body of a request.
- 
Method SummaryModifier and TypeMethodDescriptionSet the body from the given producer.body(Object producer, ParameterizedTypeReference<?> elementTypeRef) Set the body from the given producer.body(BodyInserter<?, ? super ClientHttpRequest> inserter) Set the body of the request to the givenBodyInserter.<T,S extends Publisher<T>> 
 WebTestClient.RequestHeadersSpec<?>Set the body from the givenPublisher.<T,S extends Publisher<T>> 
 WebTestClient.RequestHeadersSpec<?>body(S publisher, ParameterizedTypeReference<T> elementTypeRef) Variant ofbody(Publisher, Class)that allows providing element type information with generics.Set the body to the givenObjectvalue.contentLength(long contentLength) Set the length of the body in bytes, as specified by theContent-Lengthheader.contentType(MediaType contentType) Set the media type of the body, as specified by theContent-Typeheader.Deprecated.Methods inherited from interface org.springframework.test.web.reactive.server.WebTestClient.RequestHeadersSpecaccept, acceptCharset, attribute, attributes, cookie, cookies, exchange, header, headers, ifModifiedSince, ifNoneMatch
- 
Method Details- 
contentLengthSet the length of the body in bytes, as specified by theContent-Lengthheader.- Parameters:
- contentLength- the content length
- Returns:
- the same instance
- See Also:
 
- 
contentTypeSet the media type of the body, as specified by theContent-Typeheader.- Parameters:
- contentType- the content type
- Returns:
- the same instance
- See Also:
 
- 
bodyValueSet the body to the givenObjectvalue. This method invokes thebodyValuemethod on the underlyingWebClient.- Parameters:
- body- the value to write to the request body
- Returns:
- spec for further declaration of the request
- Since:
- 5.2
 
- 
body<T,S extends Publisher<T>> WebTestClient.RequestHeadersSpec<?> body(S publisher, Class<T> elementClass) - Type Parameters:
- T- the type of the elements contained in the publisher
- S- the type of the- Publisher
- Parameters:
- publisher- the request body data
- elementClass- the class of elements contained in the publisher
- Returns:
- spec for further declaration of the request
 
- 
body<T,S extends Publisher<T>> WebTestClient.RequestHeadersSpec<?> body(S publisher, ParameterizedTypeReference<T> elementTypeRef) Variant ofbody(Publisher, Class)that allows providing element type information with generics.- Type Parameters:
- T- the type of the elements contained in the publisher
- S- the type of the- Publisher
- Parameters:
- publisher- the request body data
- elementTypeRef- the type reference of elements contained in the publisher
- Returns:
- spec for further declaration of the request
- Since:
- 5.2
 
- 
bodySet the body from the given producer. This method invokes thebody(Object, Class)method on the underlyingWebClient.- Parameters:
- producer- the producer to write to the request. This must be a- Publisheror another producer adaptable to a- Publishervia- ReactiveAdapterRegistry
- elementClass- the class of elements contained in the producer
- Returns:
- spec for further declaration of the request
- Since:
- 5.2
 
- 
bodyWebTestClient.RequestHeadersSpec<?> body(Object producer, ParameterizedTypeReference<?> elementTypeRef) Set the body from the given producer. This method invokes thebody(Object, ParameterizedTypeReference)method on the underlyingWebClient.- Parameters:
- producer- the producer to write to the request. This must be a- Publisheror another producer adaptable to a- Publishervia- ReactiveAdapterRegistry
- elementTypeRef- the type reference of elements contained in the producer
- Returns:
- spec for further declaration of the request
- Since:
- 5.2
 
- 
bodySet the body of the request to the givenBodyInserter. This method invokes thebody(BodyInserter)method on the underlyingWebClient.- Parameters:
- inserter- the body inserter to use
- Returns:
- spec for further declaration of the request
- See Also:
 
- 
syncBodyDeprecated.as of Spring Framework 5.2 in favor ofbodyValue(Object)Shortcut forbody(BodyInserter)with a value inserter. As of 5.2 this method delegates tobodyValue(Object).
 
- 
bodyValue(Object)