@ -78,43 +78,43 @@ public interface WebTestClient {
@@ -78,43 +78,43 @@ public interface WebTestClient {
* Prepare an HTTP GET request .
* @return a spec for specifying the target URL
* /
UriSpec get ( ) ;
UriSpec < RequestHeadersSpec < ? > > get ( ) ;
/ * *
* Prepare an HTTP HEAD request .
* @return a spec for specifying the target URL
* /
UriSpec head ( ) ;
UriSpec < RequestHeadersSpec < ? > > head ( ) ;
/ * *
* Prepare an HTTP POST request .
* @return a spec for specifying the target URL
* /
UriSpec post ( ) ;
UriSpec < RequestBodySpec > post ( ) ;
/ * *
* Prepare an HTTP PUT request .
* @return a spec for specifying the target URL
* /
UriSpec put ( ) ;
UriSpec < RequestBodySpec > put ( ) ;
/ * *
* Prepare an HTTP PATCH request .
* @return a spec for specifying the target URL
* /
UriSpec patch ( ) ;
UriSpec < RequestBodySpec > patch ( ) ;
/ * *
* Prepare an HTTP DELETE request .
* @return a spec for specifying the target URL
* /
UriSpec delete ( ) ;
UriSpec < RequestHeadersSpec < ? > > delete ( ) ;
/ * *
* Prepare an HTTP OPTIONS request .
* @return a spec for specifying the target URL
* /
UriSpec options ( ) ;
UriSpec < RequestHeadersSpec < ? > > options ( ) ;
/ * *
@ -327,13 +327,13 @@ public interface WebTestClient {
@@ -327,13 +327,13 @@ public interface WebTestClient {
/ * *
* Specification for providing the URI of a request .
* /
interface UriSpec {
interface UriSpec < S extends RequestHeadersSpec < ? > > {
/ * *
* Specify the URI using an absolute , fully constructed { @link URI } .
* @return spec to add headers or perform the exchange
* /
Header Spec uri ( URI uri ) ;
S uri ( URI uri ) ;
/ * *
* Specify the URI for the request using a URI template and URI variables .
@ -341,7 +341,7 @@ public interface WebTestClient {
@@ -341,7 +341,7 @@ public interface WebTestClient {
* with a base URI ) it will be used to expand the URI template .
* @return spec to add headers or perform the exchange
* /
Header Spec uri ( String uri , Object . . . uriVariables ) ;
S uri ( String uri , Object . . . uriVariables ) ;
/ * *
* Specify the URI for the request using a URI template and URI variables .
@ -349,21 +349,21 @@ public interface WebTestClient {
@@ -349,21 +349,21 @@ public interface WebTestClient {
* with a base URI ) it will be used to expand the URI template .
* @return spec to add headers or perform the exchange
* /
Header Spec uri ( String uri , Map < String , ? > uriVariables ) ;
S uri ( String uri , Map < String , ? > uriVariables ) ;
/ * *
* Build the URI for the request with a { @link UriBuilder } obtained
* through the { @link UriBuilderFactory } configured for this client .
* @return spec to add headers or perform the exchange
* /
Header Spec uri ( Function < UriBuilder , URI > uriFunction ) ;
S uri ( Function < UriBuilder , URI > uriFunction ) ;
}
/ * *
* Specification for adding request headers and performing an exchange .
* /
interface HeaderSpec {
interface Request Headers Spec< S extends RequestHeadersSpec < S > > {
/ * *
* Set the list of acceptable { @linkplain MediaType media types } , as
@ -371,7 +371,7 @@ public interface WebTestClient {
@@ -371,7 +371,7 @@ public interface WebTestClient {
* @param acceptableMediaTypes the acceptable media types
* @return the same instance
* /
Header Spec accept ( MediaType . . . acceptableMediaTypes ) ;
S accept ( MediaType . . . acceptableMediaTypes ) ;
/ * *
* Set the list of acceptable { @linkplain Charset charsets } , as specified
@ -379,25 +379,7 @@ public interface WebTestClient {
@@ -379,25 +379,7 @@ public interface WebTestClient {
* @param acceptableCharsets the acceptable charsets
* @return the same instance
* /
HeaderSpec acceptCharset ( Charset . . . acceptableCharsets ) ;
/ * *
* Set the length of the body in bytes , as specified by the
* { @code Content - Length } header .
* @param contentLength the content length
* @return the same instance
* @see HttpHeaders # setContentLength ( long )
* /
HeaderSpec contentLength ( long contentLength ) ;
/ * *
* Set the { @linkplain MediaType media type } of the body , as specified
* by the { @code Content - Type } header .
* @param contentType the content type
* @return the same instance
* @see HttpHeaders # setContentType ( MediaType )
* /
HeaderSpec contentType ( MediaType contentType ) ;
S acceptCharset ( Charset . . . acceptableCharsets ) ;
/ * *
* Add a cookie with the given name and value .
@ -405,7 +387,7 @@ public interface WebTestClient {
@@ -405,7 +387,7 @@ public interface WebTestClient {
* @param value the cookie value
* @return the same instance
* /
Header Spec cookie ( String name , String value ) ;
S cookie ( String name , String value ) ;
/ * *
* Copy the given cookies into the entity ' s cookies map .
@ -413,7 +395,7 @@ public interface WebTestClient {
@@ -413,7 +395,7 @@ public interface WebTestClient {
* @param cookies the existing cookies to copy from
* @return the same instance
* /
Header Spec cookies ( MultiValueMap < String , String > cookies ) ;
S cookies ( MultiValueMap < String , String > cookies ) ;
/ * *
* Set the value of the { @code If - Modified - Since } header .
@ -422,14 +404,14 @@ public interface WebTestClient {
@@ -422,14 +404,14 @@ public interface WebTestClient {
* @param ifModifiedSince the new value of the header
* @return the same instance
* /
Header Spec ifModifiedSince ( ZonedDateTime ifModifiedSince ) ;
S ifModifiedSince ( ZonedDateTime ifModifiedSince ) ;
/ * *
* Set the values of the { @code If - None - Match } header .
* @param ifNoneMatches the new value of the header
* @return the same instance
* /
Header Spec ifNoneMatch ( String . . . ifNoneMatches ) ;
S ifNoneMatch ( String . . . ifNoneMatches ) ;
/ * *
* Add the given , single header value under the given name .
@ -437,14 +419,14 @@ public interface WebTestClient {
@@ -437,14 +419,14 @@ public interface WebTestClient {
* @param headerValues the header value ( s )
* @return the same instance
* /
Header Spec header ( String headerName , String . . . headerValues ) ;
S header ( String headerName , String . . . headerValues ) ;
/ * *
* Copy the given headers into the entity ' s headers map .
* @param headers the existing headers to copy from
* @return the same instance
* /
Header Spec headers ( HttpHeaders headers ) ;
S headers ( HttpHeaders headers ) ;
/ * *
* Perform the exchange without a request body .
@ -452,26 +434,55 @@ public interface WebTestClient {
@@ -452,26 +434,55 @@ public interface WebTestClient {
* /
ResponseSpec exchange ( ) ;
}
interface RequestBodySpec extends RequestHeadersSpec < RequestBodySpec > {
/ * *
* Set the length of the body in bytes , as specified by the
* { @code Content - Length } header .
* @param contentLength the content length
* @return the same instance
* @see HttpHeaders # setContentLength ( long )
* /
RequestBodySpec contentLength ( long contentLength ) ;
/ * *
* Perform the exchange with the body for the request populated using
* a { @link BodyInserter } .
* Set the { @linkplain MediaType media type } of the body , as specified
* by the { @code Content - Type } header .
* @param contentType the content type
* @return the same instance
* @see HttpHeaders # setContentType ( MediaType )
* /
RequestBodySpec contentType ( MediaType contentType ) ;
/ * *
* Set the body of the request to the given { @code BodyInserter } .
* @param inserter the inserter
* @param < T > the body type , or the the element type ( for a stream )
* @return spec for decoding the response
* @see org . springframework . web . reactive . function . BodyInserters
* /
< T > ResponseSpec exchange ( BodyInserter < T , ? super ClientHttpRequest > inserter ) ;
< T > RequestHeadersSpec < ? > body ( BodyInserter < T , ? super ClientHttpRequest > inserter ) ;
/ * *
* Perform the exchange and use the given { @code Publisher } for the
* request body .
* Set the body of the request to the given { @code Publisher } .
* @param publisher the request body data
* @param elementClass the class of elements contained in the publisher
* @param < T > the type of the elements contained in the publisher
* @param < S > the type of the { @code Publisher }
* @return spec for decoding the response
* /
< T , S extends Publisher < T > > ResponseSpec exchange ( S publisher , Class < T > elementClass ) ;
< T , S extends Publisher < T > > RequestHeadersSpec < ? > body ( S publisher , Class < T > elementClass ) ;
/ * *
* Set the body of the request to the given { @code Object } and
* perform the request .
* @param body the { @code Object } to write to the request
* @param < T > the type contained in the body
* @return a { @code Mono } with the response
* /
< T > RequestHeadersSpec < ? > body ( T body ) ;
}
/ * *