public class ExchangeResult extends Object
WebTestClient
.
Note that a decoded response body is not exposed at this level since the
body may not have been decoded and consumed yet. Subtypes
EntityExchangeResult
and FluxExchangeResult
provide access
to a decoded response entity and a decoded (but not consumed) response body
respectively.
EntityExchangeResult
,
FluxExchangeResult
Modifier and Type | Method and Description |
---|---|
void |
assertWithDiagnostics(Runnable assertion)
Execute the given Runnable, catch any
AssertionError , log details
about the request and response at ERROR level under the class log
category, and after that re-throw the error. |
HttpMethod |
getMethod()
Return the method of the request.
|
Object |
getMockServerResult()
Return the result from the mock server exchange, if applicable, for
further assertions on the state of the server response.
|
int |
getRawStatusCode()
Return the HTTP status code (potentially non-standard and not resolvable
through the
HttpStatus enum) as an integer. |
byte[] |
getRequestBodyContent()
Return the raw request body content written through the request.
|
HttpHeaders |
getRequestHeaders()
Return the request headers sent to the server.
|
byte[] |
getResponseBodyContent()
Return the raw request body content written to the response.
|
MultiValueMap<String,ResponseCookie> |
getResponseCookies()
Return response cookies received from the server.
|
HttpHeaders |
getResponseHeaders()
Return the response headers received from the server.
|
HttpStatus |
getStatus()
Return the HTTP status code as an
HttpStatus enum value. |
String |
getUriTemplate()
Return the original URI template used to prepare the request, if any.
|
URI |
getUrl()
Return the URI of the request.
|
String |
toString() |
public HttpMethod getMethod()
public URI getUrl()
@Nullable public String getUriTemplate()
public HttpHeaders getRequestHeaders()
@Nullable public byte[] getRequestBodyContent()
Note: If the request content has not been consumed for any reason yet, use of this method will trigger consumption.
IllegalStateException
- if the request body has not been fully written.public HttpStatus getStatus()
HttpStatus
enum value.public int getRawStatusCode()
HttpStatus
enum) as an integer.public HttpHeaders getResponseHeaders()
public MultiValueMap<String,ResponseCookie> getResponseCookies()
@Nullable public byte[] getResponseBodyContent()
Note: If the response content has not been consumed yet, use of this method will trigger consumption.
IllegalStateException
- if the response has not been fully read.@Nullable public Object getMockServerResult()
MockMvcWebTestClient.resultActionsFor(ExchangeResult)
public void assertWithDiagnostics(Runnable assertion)
AssertionError
, log details
about the request and response at ERROR level under the class log
category, and after that re-throw the error.