类 ExchangeResult

java.lang.Object
cn.taketoday.test.web.reactive.server.ExchangeResult
直接已知子类:
EntityExchangeResult, FluxExchangeResult

public class ExchangeResult extends Object
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.

从以下版本开始:
4.0
作者:
Rossen Stoyanchev, Sam Brannen
另请参阅:
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    private boolean
    Ensure single logging, e.g. for expectAll.
    private static final cn.taketoday.logging.Logger
     
    private final Object
     
    private static final List<cn.taketoday.http.MediaType>
     
    private final cn.taketoday.http.client.reactive.ClientHttpRequest
     
    private final reactor.core.publisher.Mono<byte[]>
     
    private final cn.taketoday.http.client.reactive.ClientHttpResponse
     
    private final reactor.core.publisher.Mono<byte[]>
     
    private final Duration
     
    private final String
     
  • 构造器概要

    构造器
    构造器
    说明
    ExchangeResult(cn.taketoday.http.client.reactive.ClientHttpRequest request, cn.taketoday.http.client.reactive.ClientHttpResponse response, reactor.core.publisher.Mono<byte[]> requestBody, reactor.core.publisher.Mono<byte[]> responseBody, Duration timeout, String uriTemplate, Object serverResult)
    Create an instance with an HTTP request and response along with promises for the serialized request and response body content.
    Copy constructor to use after body is decoded and/or consumed.
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    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.
    private String
    formatBody(cn.taketoday.http.MediaType contentType, reactor.core.publisher.Mono<byte[]> body)
     
    private String
    formatHeaders(cn.taketoday.http.HttpHeaders headers, String delimiter)
     
    private String
     
    private String
    formatStatus(cn.taketoday.http.HttpStatusCode statusCode)
     
    cn.taketoday.http.HttpMethod
    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
    Return the HTTP status code as an integer.
    byte[]
    Return the raw request body content written through the request.
    cn.taketoday.http.HttpHeaders
    Return the request headers sent to the server.
    byte[]
    Return the raw request body content written to the response.
    cn.taketoday.util.MultiValueMap<String,cn.taketoday.http.ResponseCookie>
    Return response cookies received from the server.
    cn.taketoday.http.HttpHeaders
    Return the response headers received from the server.
    cn.taketoday.http.HttpStatusCode
    Return the HTTP status code as an HttpStatusCode value.
    Return the original URI template used to prepare the request, if any.
    Return the URI of the request.
     

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 字段详细资料

    • logger

      private static final cn.taketoday.logging.Logger logger
    • PRINTABLE_MEDIA_TYPES

      private static final List<cn.taketoday.http.MediaType> PRINTABLE_MEDIA_TYPES
    • request

      private final cn.taketoday.http.client.reactive.ClientHttpRequest request
    • response

      private final cn.taketoday.http.client.reactive.ClientHttpResponse response
    • requestBody

      private final reactor.core.publisher.Mono<byte[]> requestBody
    • responseBody

      private final reactor.core.publisher.Mono<byte[]> responseBody
    • timeout

      private final Duration timeout
    • uriTemplate

      @Nullable private final String uriTemplate
    • mockServerResult

      @Nullable private final Object mockServerResult
    • diagnosticsLogged

      private boolean diagnosticsLogged
      Ensure single logging, e.g. for expectAll.
  • 构造器详细资料

    • ExchangeResult

      ExchangeResult(cn.taketoday.http.client.reactive.ClientHttpRequest request, cn.taketoday.http.client.reactive.ClientHttpResponse response, reactor.core.publisher.Mono<byte[]> requestBody, reactor.core.publisher.Mono<byte[]> responseBody, Duration timeout, @Nullable String uriTemplate, @Nullable Object serverResult)
      Create an instance with an HTTP request and response along with promises for the serialized request and response body content.
      参数:
      request - the HTTP request
      response - the HTTP response
      requestBody - capture of serialized request body content
      responseBody - capture of serialized response body content
      timeout - how long to wait for content to materialize
      uriTemplate - the URI template used to set up the request, if any
      serverResult - the result of a mock server exchange if applicable.
    • ExchangeResult

      ExchangeResult(ExchangeResult other)
      Copy constructor to use after body is decoded and/or consumed.
  • 方法详细资料

    • getMethod

      public cn.taketoday.http.HttpMethod getMethod()
      Return the method of the request.
    • getUrl

      public URI getUrl()
      Return the URI of the request.
    • getUriTemplate

      @Nullable public String getUriTemplate()
      Return the original URI template used to prepare the request, if any.
    • getRequestHeaders

      public cn.taketoday.http.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 has not been fully written.
    • getStatus

      public cn.taketoday.http.HttpStatusCode getStatus()
      Return the HTTP status code as an HttpStatusCode value.
    • getRawStatusCode

      public int getRawStatusCode()
      Return the HTTP status code as an integer.
    • getResponseHeaders

      public cn.taketoday.http.HttpHeaders getResponseHeaders()
      Return the response headers received from the server.
    • getResponseCookies

      public cn.taketoday.util.MultiValueMap<String,cn.taketoday.http.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 has not been fully read.
    • getMockServerResult

      @Nullable public Object getMockServerResult()
      Return the result from the mock server exchange, if applicable, for further assertions on the state of the server response.
      另请参阅:
    • assertWithDiagnostics

      public 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.
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • formatStatus

      private String formatStatus(cn.taketoday.http.HttpStatusCode statusCode)
    • formatHeaders

      private String formatHeaders(cn.taketoday.http.HttpHeaders headers, String delimiter)
    • formatBody

      @Nullable private String formatBody(@Nullable cn.taketoday.http.MediaType contentType, reactor.core.publisher.Mono<byte[]> body)
    • formatMockServerResult

      private String formatMockServerResult()