Class ExchangeResult
java.lang.Object
org.springframework.test.web.reactive.server.ExchangeResult
- Direct Known Subclasses:
EntityExchangeResult
,FluxExchangeResult
Container for request and response details for exchanges performed through
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.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertWithDiagnostics
(Runnable assertion) Execute the given Runnable, catch anyAssertionError
, log details about the request and response at ERROR level under the class log category, and after that re-throw the error.Return the method of the request.Return the result from the mock server exchange, if applicable, for further assertions on the state of the server response.int
Deprecated.byte[]
Return the raw request body content written through the request.Return the request headers sent to the server.byte[]
Return the raw request body content written to the response.Return response cookies received from the server.Return the response headers received from the server.Return the HTTP status code as anHttpStatusCode
value.Return the original URI template used to prepare the request, if any.getUrl()
Return the URI of the request.toString()
-
Method Details
-
getMethod
Return the method of the request. -
getUrl
Return the URI of the request. -
getUriTemplate
Return the original URI template used to prepare the request, if any. -
getRequestHeaders
Return the request headers sent to the server. -
getRequestBodyContent
Return the raw request body content written through the request.Note: If the request content has not been consumed for any reason yet, use of this method will trigger consumption.
- Throws:
IllegalStateException
- if the request body has not been fully written.
-
getStatus
Return the HTTP status code as anHttpStatusCode
value. -
getRawStatusCode
Deprecated.as of 6.0, in favor ofgetStatus()
Return the HTTP status code as an integer.- Since:
- 5.1.10
-
getResponseHeaders
Return the response headers received from the server. -
getResponseCookies
Return response cookies received from the server. -
getResponseBodyContent
Return the raw request body content written to the response.Note: If the response content has not been consumed yet, use of this method will trigger consumption.
- Throws:
IllegalStateException
- if the response has not been fully read.
-
getMockServerResult
Return the result from the mock server exchange, if applicable, for further assertions on the state of the server response.- Since:
- 5.3
- See Also:
-
assertWithDiagnostics
Execute the given Runnable, catch anyAssertionError
, log details about the request and response at ERROR level under the class log category, and after that re-throw the error. -
toString
-
getStatus()