public static interface WebTestClient.HeaderSpec
Modifier and Type | Method and Description |
---|---|
WebTestClient.HeaderSpec |
accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept header. |
WebTestClient.HeaderSpec |
acceptCharset(java.nio.charset.Charset... acceptableCharsets)
Set the list of acceptable charsets, as specified
by the
Accept-Charset header. |
WebTestClient.HeaderSpec |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
WebTestClient.HeaderSpec |
contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
WebTestClient.HeaderSpec |
cookie(java.lang.String name,
java.lang.String value)
Add a cookie with the given name and value.
|
WebTestClient.HeaderSpec |
cookies(MultiValueMap<java.lang.String,java.lang.String> cookies)
Copy the given cookies into the entity's cookies map.
|
WebTestClient.ResponseSpec |
exchange()
Perform the exchange without a request body.
|
<T> WebTestClient.ResponseSpec |
exchange(BodyInserter<T,? super ClientHttpRequest> inserter)
Perform the exchange with the body for the request populated using
a
BodyInserter . |
<T,S extends <any>> |
exchange(S publisher,
java.lang.Class<T> elementClass)
Perform the exchange and use the given
Publisher for the
request body. |
WebTestClient.HeaderSpec |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given, single header value under the given name.
|
WebTestClient.HeaderSpec |
headers(HttpHeaders headers)
Copy the given headers into the entity's headers map.
|
WebTestClient.HeaderSpec |
ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
Set the value of the
If-Modified-Since header. |
WebTestClient.HeaderSpec |
ifNoneMatch(java.lang.String... ifNoneMatches)
Set the values of the
If-None-Match header. |
WebTestClient.HeaderSpec accept(MediaType... acceptableMediaTypes)
Accept
header.acceptableMediaTypes
- the acceptable media typesWebTestClient.HeaderSpec acceptCharset(java.nio.charset.Charset... acceptableCharsets)
Accept-Charset
header.acceptableCharsets
- the acceptable charsetsWebTestClient.HeaderSpec contentLength(long contentLength)
Content-Length
header.contentLength
- the content lengthHttpHeaders.setContentLength(long)
WebTestClient.HeaderSpec contentType(MediaType contentType)
Content-Type
header.contentType
- the content typeHttpHeaders.setContentType(MediaType)
WebTestClient.HeaderSpec cookie(java.lang.String name, java.lang.String value)
name
- the cookie namevalue
- the cookie valueWebTestClient.HeaderSpec cookies(MultiValueMap<java.lang.String,java.lang.String> cookies)
cookies
- the existing cookies to copy fromWebTestClient.HeaderSpec ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
If-Modified-Since
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
ifModifiedSince
- the new value of the headerWebTestClient.HeaderSpec ifNoneMatch(java.lang.String... ifNoneMatches)
If-None-Match
header.ifNoneMatches
- the new value of the headerWebTestClient.HeaderSpec header(java.lang.String headerName, java.lang.String... headerValues)
headerName
- the header nameheaderValues
- the header value(s)WebTestClient.HeaderSpec headers(HttpHeaders headers)
headers
- the existing headers to copy fromWebTestClient.ResponseSpec exchange()
<T> WebTestClient.ResponseSpec exchange(BodyInserter<T,? super ClientHttpRequest> inserter)
BodyInserter
.T
- the body type, or the the element type (for a stream)inserter
- the inserterBodyInserters
<T,S extends <any>> WebTestClient.ResponseSpec exchange(S publisher, java.lang.Class<T> elementClass)
Publisher
for the
request body.T
- the type of the elements contained in the publisherS
- the type of the Publisher
publisher
- the request body dataelementClass
- the class of elements contained in the publisher