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 the body of a request.
- since:
- 5.0
- Author:
- Rossen stoyanchev, Brian Clozel, sam Brannen, MichaĆ Rowicki
-
Method summary
Modifier 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.Methods inherited from interface WebTestClient.RequestHeadersspec
accept, acceptCharset, apiVersion, attribute, attributes, cookie, cookies, exchange, exchangesuccessfully, header, headers, ifModifiedsince, ifNoneMatch
-
Method Details
-
contentLength
set the length of the body in bytes, as specified by theContent-Lengthheader.- Parameters:
contentLength- the content length- Returns:
- this spec for further declaration of the request
- see Also:
-
contentType
set the media type of the body, as specified by theContent-Typeheader.- Parameters:
contentType- the content type- Returns:
- this spec for further declaration of the request
- see Also:
-
bodyValue
set the body to the givenObjectvalue. This method invokes thebodyValuemethod on the underlyingWebClient.- Parameters:
body- the value to write to the request body- Returns:
- this 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 publishers- the type of thePublisher- Parameters:
publisher- the request body dataelementClass- the class of elements contained in the publisher- Returns:
- this 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 publishers- the type of thePublisher- Parameters:
publisher- the request body dataelementTypeRef- the type reference of elements contained in the publisher- Returns:
- this spec for further declaration of the request
- since:
- 5.2
-
body
set 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 aPublisheror another producer adaptable to aPublisherviaReactiveAdapterRegistryelementClass- the class of elements contained in the producer- Returns:
- this spec for further declaration of the request
- since:
- 5.2
-
body
WebTestClient.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 aPublisheror another producer adaptable to aPublisherviaReactiveAdapterRegistryelementTypeRef- the type reference of elements contained in the producer- Returns:
- this spec for further declaration of the request
- since:
- 5.2
-
body
WebTestClient.RequestHeadersspec<?> body(BodyInserter<?, ? super ClientHttpRequest> inserter) set the body of the request to the givenBodyInserter.This method invokes the
body(BodyInserter)method on the underlyingWebClient.- Parameters:
inserter- the body inserter to use- Returns:
- this spec for further declaration of the request
- see Also:
-