类 ExchangeResult
- java.lang.Object
- org.springframework.test.web.reactive.server.ExchangeResult
public class ExchangeResult extends Object
Container for request and response details for exchanges performed throughWebTestClient
.Note that a decoded response body is not exposed at this level since the body may not have been decoded and consumed yet. Sub-types
EntityExchangeResult
andFluxExchangeResult
provide access to a decoded response entity and a decoded (but not consumed) response body respectively.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
EntityExchangeResult
,FluxExchangeResult
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
assertWithDiagnostics(Runnable assertion)
Execute the given Runnable, catch anyAssertionError
, decorate withAssertionError
containing diagnostic information about the request and response, and then re-throw.HttpMethod
getMethod()
Return the method of the request.int
getRawStatusCode()
Return the HTTP status code (potentially non-standard and not resolvable through theHttpStatus
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 anHttpStatus
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()
方法详细资料
getMethod
public HttpMethod getMethod()
Return the method of the request.
getUriTemplate
@Nullable public String getUriTemplate()
Return the original URI template used to prepare the request, if any.
getRequestHeaders
public HttpHeaders getRequestHeaders()
Return the request headers sent to the server.
getRequestBodyContent
@Nullable public byte[] 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.
- 抛出:
IllegalStateException
- if the request body is not been fully written.
getStatus
public HttpStatus getStatus()
Return the HTTP status code as anHttpStatus
enum value.
getRawStatusCode
public int getRawStatusCode()
Return the HTTP status code (potentially non-standard and not resolvable through theHttpStatus
enum) as an integer.- 从以下版本开始:
- 5.1.10
getResponseHeaders
public HttpHeaders getResponseHeaders()
Return the response headers received from the server.
getResponseCookies
public MultiValueMap<String,ResponseCookie> getResponseCookies()
Return response cookies received from the server.
getResponseBodyContent
@Nullable public byte[] 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.
- 抛出:
IllegalStateException
- if the response is not been fully read.
assertWithDiagnostics
public void assertWithDiagnostics(Runnable assertion)
Execute the given Runnable, catch anyAssertionError
, decorate withAssertionError
containing diagnostic information about the request and response, and then re-throw.