case class RequestT[U[_], T, -R](method: U[Method], uri: U[Uri], body: RequestBody[R], headers: Seq[Header], response: ResponseAs[T, R], options: RequestOptions, tags: Map[String, Any]) extends HasHeaders with RequestTExtensions[U, T, R] with Product with Serializable

Describes a HTTP request, along with a description of how the response body should be handled.

The request can be sent:

  • synchronously, using SimpleHttpClient.send()
  • using the send(SttpBackend) methods, which support any effect. The backend must provide a superset of the capabilities required by the request.
U

Specifies if the method & uri are specified. By default can be either: * Empty, which is a type constructor which always resolves to None. This type of request is aliased to PartialRequest: there's no method and uri specified, and the request cannot be sent. * Identity, which is an identity type constructor. This type of request is aliased to Request: the method and uri are specified, and the request can be sent.

T

The target type, to which the response body should be read.

R

The backend capabilities required by the request or response description. This might be Any (no requirements), Effect (the backend must support the given effect type), Streams (the ability to send and receive streaming bodies) or sttp.capabilities.WebSockets (the ability to handle websocket requests).

response

Description of how the response body should be handled. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it. An exception to this are unsafe streaming and websocket responses, which need to be consumed/closed by the client.

tags

Request-specific tags which can be used by backends for logging, metrics, etc. Not used by default.

Linear Supertypes
Serializable, Serializable, Product, Equals, RequestTExtensions[U, T, R], HasHeaders, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RequestT
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. RequestTExtensions
  7. HasHeaders
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RequestT(method: U[Method], uri: U[Uri], body: RequestBody[R], headers: Seq[Header], response: ResponseAs[T, R], options: RequestOptions, tags: Map[String, Any])

    response

    Description of how the response body should be handled. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it. An exception to this are unsafe streaming and websocket responses, which need to be consumed/closed by the client.

    tags

    Request-specific tags which can be used by backends for logging, metrics, etc. Not used by default.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def acceptEncoding(encoding: String): RequestT[U, T, R]
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def auth: SpecifyAuthScheme[U, T, R]
  7. def autoDecompressionDisabled: Boolean
  8. def body(fs: Seq[(String, String)], encoding: String): RequestT[U, T, R]

    Encodes the given parameters as form data.

    Encodes the given parameters as form data. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

    If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

  9. def body(fs: (String, String)*): RequestT[U, T, R]

    Encodes the given parameters as form data using utf-8.

    Encodes the given parameters as form data using utf-8. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

    If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

  10. def body(fs: Map[String, String], encoding: String): RequestT[U, T, R]

    Encodes the given parameters as form data.

    Encodes the given parameters as form data. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

    If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

  11. def body(fs: Map[String, String]): RequestT[U, T, R]

    Encodes the given parameters as form data using utf-8.

    Encodes the given parameters as form data using utf-8. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

    If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

  12. def body(b: InputStream): RequestT[U, T, R]

    If content type is not yet specified, will be set to application/octet-stream.

  13. def body(b: ByteBuffer): RequestT[U, T, R]

    If content type is not yet specified, will be set to application/octet-stream.

  14. def body(b: Array[Byte]): RequestT[U, T, R]

    If content type is not yet specified, will be set to application/octet-stream.

    If content type is not yet specified, will be set to application/octet-stream.

    If content length is not yet specified, will be set to the length of the given array.

  15. def body(b: String, encoding: String): RequestT[U, T, R]

    If content type is not yet specified, will be set to text/plain with the given encoding.

    If content type is not yet specified, will be set to text/plain with the given encoding.

    If content length is not yet specified, will be set to the number of bytes in the string using the given encoding.

  16. def body(b: String): RequestT[U, T, R]

    Uses the utf-8 encoding.

    Uses the utf-8 encoding.

    If content type is not yet specified, will be set to text/plain with utf-8 encoding.

    If content length is not yet specified, will be set to the number of bytes in the string using the utf-8 encoding.

  17. def body[B](b: B)(implicit arg0: BodySerializer[B]): RequestT[U, T, R]

    If content type is not yet specified, will be set to application/octet-stream.

    If content type is not yet specified, will be set to application/octet-stream.

    Definition Classes
    RequestTExtensions
  18. def body(path: Path): RequestT[U, T, R]

    If content type is not yet specified, will be set to application/octet-stream.

    If content type is not yet specified, will be set to application/octet-stream.

    If content length is not yet specified, will be set to the length of the given file.

    Definition Classes
    RequestTExtensions
  19. def body(file: File): RequestT[U, T, R]

    If content type is not yet specified, will be set to application/octet-stream.

    If content type is not yet specified, will be set to application/octet-stream.

    If content length is not yet specified, will be set to the length of the given file.

    Definition Classes
    RequestTExtensions
  20. val body: RequestBody[R]
  21. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  22. def contentLength(l: Long): RequestT[U, T, R]
  23. def contentLength: Option[Long]
    Definition Classes
    HasHeaders
  24. def contentType(ct: String, encoding: String): RequestT[U, T, R]
  25. def contentType(mt: MediaType): RequestT[U, T, R]
  26. def contentType(ct: String): RequestT[U, T, R]
  27. def contentType: Option[String]
    Definition Classes
    HasHeaders
  28. def cookie(n: String, v: String): RequestT[U, T, R]
  29. def cookie(nv: (String, String)): RequestT[U, T, R]
  30. def cookies(nvs: (String, String)*): RequestT[U, T, R]
  31. def cookies(cs: Iterable[CookieWithMeta]): RequestT[U, T, R]
  32. def cookies(r: Response[_]): RequestT[U, T, R]
  33. def cookies: Seq[Either[String, CookieWithMeta]]
    Definition Classes
    HasHeaders
  34. def delete(uri: Uri): Request[T, R]
  35. def disableAutoDecompression: RequestT[U, T, R]
  36. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  37. def followRedirects(fr: Boolean): RequestT[U, T, R]
  38. def get(uri: Uri): Request[T, R]
  39. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  40. def head(uri: Uri): Request[T, R]
  41. def header(k: String, ov: Option[String]): RequestT[U, T, R]

    Adds the given header to the end of the headers sequence, if the value is defined.

    Adds the given header to the end of the headers sequence, if the value is defined. Otherwise has no effect.

  42. def header(k: String, v: String): RequestT[U, T, R]

    Adds the given header to the end of the headers sequence.

  43. def header(k: String, v: String, replaceExisting: Boolean): RequestT[U, T, R]

    Adds the given header to the end of the headers sequence.

    Adds the given header to the end of the headers sequence.

    replaceExisting

    If there's already a header with the same name, should it be replaced?

  44. def header(h: Header, replaceExisting: Boolean = false): RequestT[U, T, R]

    Adds the given header to the end of the headers sequence.

    Adds the given header to the end of the headers sequence.

    replaceExisting

    If there's already a header with the same name, should it be replaced?

  45. def header(h: String): Option[String]
    Definition Classes
    HasHeaders
  46. def headers(hs: Seq[Header], replaceExisting: Boolean): RequestT[U, T, R]

    Adds the given headers to the end of the headers sequence.

  47. def headers(hs: Header*): RequestT[U, T, R]

    Adds the given headers to the end of the headers sequence.

  48. def headers(hs: Map[String, String], replaceExisting: Boolean): RequestT[U, T, R]

    Adds the given headers to the end of the headers sequence.

    Adds the given headers to the end of the headers sequence.

    replaceExisting

    If there's already a header with the same name, should it be replaced?

  49. def headers(hs: Map[String, String]): RequestT[U, T, R]

    Adds the given headers to the end of the headers sequence.

  50. def headers(h: String): Seq[String]
    Definition Classes
    HasHeaders
  51. val headers: Seq[Header]
    Definition Classes
    RequestT → HasHeaders
  52. def httpVersion: Option[HttpVersion]

    GetHttpVersion from tags in request.

    GetHttpVersion from tags in request. Supported only is a few backends

    returns

    one of values form HttpVersion enum or None

  53. def httpVersion(version: HttpVersion): RequestT[U, T, R]

    Allows setting HTTP version per request.

    Allows setting HTTP version per request. Supported only is a few backends

    returns

    request with version tag

  54. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  55. def isWebSocket: Boolean
  56. def logSettings(logRequestBody: Option[Boolean] = None, logResponseBody: Option[Boolean] = None, logRequestHeaders: Option[Boolean] = None, logResponseHeaders: Option[Boolean] = None): RequestT[U, T, R]

    Will only have effect when using the LoggingBackend

  57. def loggingOptions: Option[LoggingOptions]
  58. def mapResponse[T2](f: (T) ⇒ T2): RequestT[U, T2, R]
  59. def maxRedirects(n: Int): RequestT[U, T, R]
  60. def method(method: Method, uri: Uri): Request[T, R]
  61. val method: U[Method]
  62. def multipartBody[R2](p1: Part[RequestBody[R2]], ps: Part[RequestBody[R2]]*): RequestT[U, T, R with R2]
  63. def multipartBody[R2](ps: Seq[Part[RequestBody[R2]]]): RequestT[U, T, R with R2]
  64. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  65. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  66. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  67. def options(uri: Uri): Request[T, R]
  68. val options: RequestOptions
  69. def patch(uri: Uri): Request[T, R]
  70. def post(uri: Uri): Request[T, R]
  71. def proxyAuth: SpecifyAuthScheme[U, T, R]
  72. def put(uri: Uri): Request[T, R]
  73. def readTimeout(t: Duration): RequestT[U, T, R]

    When the request is sent, if reading the response times out (there's no activity for the given period of time), a failed effect will be returned, or an exception will be thrown

  74. def redirectToGet(r: Boolean): RequestT[U, T, R]

    When a POST or PUT request is redirected, should the redirect be a POST/PUT as well (with the original body), or should the request be converted to a GET without a body.

    When a POST or PUT request is redirected, should the redirect be a POST/PUT as well (with the original body), or should the request be converted to a GET without a body.

    Note that this only affects 301 and 302 redirects. 303 redirects are always converted, while 307 and 308 redirects always keep the same method.

    See https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections for details.

  75. def response[T2, R2](ra: ResponseAs[T2, R2]): RequestT[U, T2, R with R2]

    Specifies the target type to which the response body should be read.

    Specifies the target type to which the response body should be read. Note that this replaces any previous specifications, which also includes any previous mapResponse invocations.

  76. val response: ResponseAs[T, R]
  77. def send[F[_], P](backend: SttpBackend[F, P])(implicit isIdInRequest: IsIdInRequest[U], pEffectFIsR: <:<[P with Effect[F], R]): F[Response[T]]

    Sends the request, using the given backend.

    Sends the request, using the given backend. Only requests for which the method & URI are specified can be sent.

    The required capabilities must be a subset of the capabilities provided by the backend.

    returns

    For synchronous backends (when the effect type is Identity), Response is returned directly and exceptions are thrown. For asynchronous backends (when the effect type is e.g. scala.concurrent.Future), an effect containing the Response is returned. Exceptions are represented as failed effects (e.g. failed futures). The response body is deserialized as specified by this request (see RequestT.response). Known exceptions are converted by backends to one of SttpClientException. Other exceptions are thrown unchanged.

  78. def show(includeBody: Boolean = true, includeHeaders: Boolean = true, sensitiveHeaders: Set[String] = HeaderNames.SensitiveHeaders): String
  79. def showBasic: String
  80. def streamBody[S](s: Streams[S])(b: BinaryStream): RequestT[U, T, R with S]
  81. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  82. def tag(k: String): Option[Any]
  83. def tag(k: String, v: Any): RequestT[U, T, R]
  84. val tags: Map[String, Any]
  85. def toCurl(sensitiveHeaders: Set[String])(implicit isIdInRequest: IsIdInRequest[U]): String
  86. def toCurl(implicit isIdInRequest: IsIdInRequest[U]): String
  87. def toRfc2616Format(sensitiveHeaders: Set[String])(implicit isIdInRequest: IsIdInRequest[U]): String
  88. def toRfc2616Format(implicit isIdInRequest: IsIdInRequest[U]): String
  89. def unsafeCookies: Seq[CookieWithMeta]
    Definition Classes
    HasHeaders
  90. val uri: U[Uri]
  91. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  92. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  93. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated
  2. def send[F[_], P]()(implicit backend: SttpBackend[F, P], pEffectFIsR: <:<[P with Effect[F], R], isIdInRequest: IsIdInRequest[U]): F[Response[T]]

    Sends the request, using the backend from the implicit scope.

    Sends the request, using the backend from the implicit scope. Only requests for which the method & URI are specified can be sent.

    The required capabilities must be a subset of the capabilities provided by the backend.

    returns

    For synchronous backends (when the effect type is Identity), Response is returned directly and exceptions are thrown. For asynchronous backends (when the effect type is e.g. scala.concurrent.Future), an effect containing the Response is returned. Exceptions are represented as failed effects (e.g. failed futures). The response body is deserialized as specified by this request (see RequestT.response). Known exceptions are converted by backends to one of SttpClientException. Other exceptions are thrown unchanged.

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0) use request.send(backend), providing the backend explicitly

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from RequestTExtensions[U, T, R]

Inherited from HasHeaders

Inherited from AnyRef

Inherited from Any

Ungrouped