public class ExchangeResult
extends java.lang.Object
WebTestClient
.
When an ExchangeResult
is first created it has the status and the
headers of the response ready. Later when the response body is extracted,
the ExchangeResult
is re-created as EntityExchangeResult
or
FluxExchangeResult
also exposing the extracted entities.
Serialized request and response content may also be accessed through the
methods getRequestContent()
and getResponseContent()
after
that content has been fully read or written.
EntityExchangeResult
,
FluxExchangeResult
Modifier and Type | Field and Description |
---|---|
private static java.util.List<MediaType> |
PRINTABLE_MEDIA_TYPES |
private WiretapClientHttpRequest |
request |
private WiretapClientHttpResponse |
response |
Modifier | Constructor and Description |
---|---|
protected |
ExchangeResult(ExchangeResult other)
Copy constructor used when the body is decoded or consumed.
|
protected |
ExchangeResult(WiretapClientHttpRequest request,
WiretapClientHttpResponse response)
Constructor used when the
ClientHttpResponse becomes available. |
Modifier and Type | Method and Description |
---|---|
void |
assertWithDiagnostics(java.lang.Runnable assertion)
Execute the given Runnable, catch any
AssertionError , decorate
with AssertionError containing diagnostic information about the
request and response, and then re-throw. |
private java.lang.String |
formatBody(MediaType contentType,
<any> body) |
private java.lang.String |
formatHeaders(HttpHeaders headers,
java.lang.String delimiter) |
HttpMethod |
getMethod()
Return the method of the request.
|
<any> |
getRequestContent()
Return a "promise" for the raw request body content once completed.
|
HttpHeaders |
getRequestHeaders()
Return the request headers sent to the server.
|
<any> |
getResponseContent()
Return a "promise" for the raw response body content once completed.
|
MultiValueMap<java.lang.String,ResponseCookie> |
getResponseCookies()
Return response cookies received from the server.
|
HttpHeaders |
getResponseHeaders()
Return the response headers received from the server.
|
HttpStatus |
getStatus()
Return the status of the executed request.
|
private java.lang.String |
getStatusReason() |
java.net.URI |
getUrl()
Return the request headers that were sent to the server.
|
java.lang.String |
toString() |
private static final java.util.List<MediaType> PRINTABLE_MEDIA_TYPES
private final WiretapClientHttpRequest request
private final WiretapClientHttpResponse response
protected ExchangeResult(WiretapClientHttpRequest request, WiretapClientHttpResponse response)
ClientHttpResponse
becomes available.protected ExchangeResult(ExchangeResult other)
public HttpMethod getMethod()
public java.net.URI getUrl()
public HttpHeaders getRequestHeaders()
public <any> getRequestContent()
public HttpStatus getStatus()
public HttpHeaders getResponseHeaders()
public MultiValueMap<java.lang.String,ResponseCookie> getResponseCookies()
public <any> getResponseContent()
public void assertWithDiagnostics(java.lang.Runnable assertion)
AssertionError
, decorate
with AssertionError
containing diagnostic information about the
request and response, and then re-throw.public java.lang.String toString()
toString
in class java.lang.Object
private java.lang.String getStatusReason()
private java.lang.String formatHeaders(HttpHeaders headers, java.lang.String delimiter)
private java.lang.String formatBody(MediaType contentType, <any> body)