类 MockServerHttpRequest

java.lang.Object
cn.taketoday.http.server.reactive.AbstractServerHttpRequest
cn.taketoday.mock.http.server.reactive.MockServerHttpRequest
所有已实现的接口:
cn.taketoday.http.HttpMessage, cn.taketoday.http.HttpRequest, cn.taketoday.http.ReactiveHttpInputMessage, cn.taketoday.http.server.reactive.ServerHttpRequest

public final class MockServerHttpRequest extends cn.taketoday.http.server.reactive.AbstractServerHttpRequest
Mock extension of AbstractServerHttpRequest for use in tests without an actual server. Use the static methods to obtain a builder.
从以下版本开始:
4.0
作者:
Rossen Stoyanchev
  • 字段详细资料

    • httpMethod

      private final cn.taketoday.http.HttpMethod httpMethod
    • cookies

      private final cn.taketoday.util.MultiValueMap<String,cn.taketoday.http.HttpCookie> cookies
    • localAddress

      @Nullable private final InetSocketAddress localAddress
    • remoteAddress

      @Nullable private final InetSocketAddress remoteAddress
    • sslInfo

      @Nullable private final cn.taketoday.http.server.reactive.SslInfo sslInfo
    • body

      private final reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer> body
  • 构造器详细资料

    • MockServerHttpRequest

      private MockServerHttpRequest(cn.taketoday.http.HttpMethod httpMethod, URI uri, @Nullable String contextPath, cn.taketoday.http.HttpHeaders headers, cn.taketoday.util.MultiValueMap<String,cn.taketoday.http.HttpCookie> cookies, @Nullable InetSocketAddress localAddress, @Nullable InetSocketAddress remoteAddress, @Nullable cn.taketoday.http.server.reactive.SslInfo sslInfo, org.reactivestreams.Publisher<? extends cn.taketoday.core.io.buffer.DataBuffer> body)
  • 方法详细资料

    • getMethod

      public cn.taketoday.http.HttpMethod getMethod()
      指定者:
      getMethod 在接口中 cn.taketoday.http.HttpRequest
      覆盖:
      getMethod 在类中 cn.taketoday.http.server.reactive.AbstractServerHttpRequest
    • getLocalAddress

      @Nullable public InetSocketAddress getLocalAddress()
    • getRemoteAddress

      @Nullable public InetSocketAddress getRemoteAddress()
    • initSslInfo

      @Nullable protected cn.taketoday.http.server.reactive.SslInfo initSslInfo()
      指定者:
      initSslInfo 在类中 cn.taketoday.http.server.reactive.AbstractServerHttpRequest
    • getBody

      public reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer> getBody()
    • initCookies

      protected cn.taketoday.util.MultiValueMap<String,cn.taketoday.http.HttpCookie> initCookies()
      指定者:
      initCookies 在类中 cn.taketoday.http.server.reactive.AbstractServerHttpRequest
    • getNativeRequest

      public <T> T getNativeRequest()
      指定者:
      getNativeRequest 在类中 cn.taketoday.http.server.reactive.AbstractServerHttpRequest
    • get

      public static MockServerHttpRequest.BaseBuilder<?> get(String urlTemplate, Object... uriVars)
      Create an HTTP GET builder with the given URI template. The given URI may contain query parameters, or those may be added later via queryParam builder methods.
      参数:
      urlTemplate - a URL template; the resulting URL will be encoded
      uriVars - zero or more URI variables
      返回:
      the created builder
    • head

      public static MockServerHttpRequest.BaseBuilder<?> head(String urlTemplate, Object... uriVars)
      HTTP HEAD variant. See get(String, Object...) for general info.
      参数:
      urlTemplate - a URL template; the resulting URL will be encoded
      uriVars - zero or more URI variables
      返回:
      the created builder
    • post

      public static MockServerHttpRequest.BodyBuilder post(String urlTemplate, Object... uriVars)
      HTTP POST variant. See get(String, Object...) for general info.
      参数:
      urlTemplate - a URL template; the resulting URL will be encoded
      uriVars - zero or more URI variables
      返回:
      the created builder
    • put

      public static MockServerHttpRequest.BodyBuilder put(String urlTemplate, Object... uriVars)
      HTTP PUT variant. See get(String, Object...) for general info. queryParam builder methods.
      参数:
      urlTemplate - a URL template; the resulting URL will be encoded
      uriVars - zero or more URI variables
      返回:
      the created builder
    • patch

      public static MockServerHttpRequest.BodyBuilder patch(String urlTemplate, Object... uriVars)
      HTTP PATCH variant. See get(String, Object...) for general info.
      参数:
      urlTemplate - a URL template; the resulting URL will be encoded
      uriVars - zero or more URI variables
      返回:
      the created builder
    • delete

      public static MockServerHttpRequest.BaseBuilder<?> delete(String urlTemplate, Object... uriVars)
      HTTP DELETE variant. See get(String, Object...) for general info.
      参数:
      urlTemplate - a URL template; the resulting URL will be encoded
      uriVars - zero or more URI variables
      返回:
      the created builder
    • options

      public static MockServerHttpRequest.BaseBuilder<?> options(String urlTemplate, Object... uriVars)
      HTTP OPTIONS variant. See get(String, Object...) for general info.
      参数:
      urlTemplate - a URL template; the resulting URL will be encoded
      uriVars - zero or more URI variables
      返回:
      the created builder
    • method

      public static MockServerHttpRequest.BodyBuilder method(cn.taketoday.http.HttpMethod method, URI url)
      Create a builder with the given HTTP method and a URI.
      参数:
      method - the HTTP method (GET, POST, etc)
      url - the URL
      返回:
      the created builder
    • method

      public static MockServerHttpRequest.BodyBuilder method(cn.taketoday.http.HttpMethod method, String uri, Object... vars)
      Alternative to method(HttpMethod, URI) that accepts a URI template. The given URI may contain query parameters, or those may be added later via queryParam builder methods.
      参数:
      method - the HTTP method (GET, POST, etc)
      uri - the URI template for the target URL
      vars - variables to expand into the template
      返回:
      the created builder
    • method

      @Deprecated public static MockServerHttpRequest.BodyBuilder method(String httpMethod, String uri, Object... vars)
      已过时。
      Create a builder with a raw HTTP method value value that is outside the range of HttpMethod enum values.
      参数:
      httpMethod - the HTTP methodValue value
      uri - the URI template for target the URL
      vars - variables to expand into the template
      返回:
      the created builder
    • toUri

      private static URI toUri(String uri, Object[] vars)