case class RequestT[U[_], T, +S](method: U[Method], uri: U[Uri], body: RequestBody[S], headers: Seq[Header], response: ResponseAs[T, S], options: RequestOptions, tags: Map[String, Any]) extends RequestTExtensions[U, T, S] with Product with Serializable
Describes a HTTP request, along with a description of how the response body should be handled.
- 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.
- 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 streaming responses, which need to fully consumed by the client if such a response type is requested.
- tags
Request-specific tags which can be used by backends for logging, metrics, etc. Not used by default.
- Alphabetic
- By Inheritance
- RequestT
- Serializable
- Serializable
- Product
- Equals
- RequestTExtensions
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
RequestT(method: U[Method], uri: U[Uri], body: RequestBody[S], headers: Seq[Header], response: ResponseAs[T, S], 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 streaming responses, which need to fully consumed by the client if such a response type is requested.
- tags
Request-specific tags which can be used by backends for logging, metrics, etc. Not used by default.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def acceptEncoding(encoding: String): RequestT[U, T, S]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def auth: SpecifyAuthScheme[U, T, S]
-
def
body(fs: Seq[(String, String)], encoding: String): RequestT[U, T, S]
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.
-
def
body(fs: (String, String)*): RequestT[U, T, S]
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 toapplication/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.
-
def
body(fs: Map[String, String], encoding: String): RequestT[U, T, S]
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.
-
def
body(fs: Map[String, String]): RequestT[U, T, S]
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 toapplication/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.
-
def
body(b: InputStream): RequestT[U, T, S]
If content type is not yet specified, will be set to
application/octet-stream
. -
def
body(b: ByteBuffer): RequestT[U, T, S]
If content type is not yet specified, will be set to
application/octet-stream
. -
def
body(b: Array[Byte]): RequestT[U, T, S]
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.
-
def
body(b: String, encoding: String): RequestT[U, T, S]
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.
-
def
body(b: String): RequestT[U, T, S]
Uses the
utf-8
encoding.Uses the
utf-8
encoding.If content type is not yet specified, will be set to
text/plain
withutf-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. -
def
body[B](b: B)(implicit arg0: BodySerializer[B]): RequestT[U, T, S]
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
-
def
body(path: Path): RequestT[U, T, S]
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
-
def
body(file: File): RequestT[U, T, S]
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
- val body: RequestBody[S]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
- def contentLength(l: Long): RequestT[U, T, S]
- def contentType(ct: String, encoding: String): RequestT[U, T, S]
- def contentType(mt: MediaType): RequestT[U, T, S]
- def contentType(ct: String): RequestT[U, T, S]
- def cookie(n: String, v: String): RequestT[U, T, S]
- def cookie(nv: (String, String)): RequestT[U, T, S]
- def cookies(nvs: (String, String)*): RequestT[U, T, S]
- def cookies(cs: Iterable[CookieWithMeta]): RequestT[U, T, S]
- def cookies(r: Response[_]): RequestT[U, T, S]
- def delete(uri: Uri): Request[T, S]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def followRedirects(fr: Boolean): RequestT[U, T, S]
- def get(uri: Uri): Request[T, S]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def head(uri: Uri): Request[T, S]
- def header(k: String, ov: Option[String]): RequestT[U, T, S]
- def header(k: String, v: String): RequestT[U, T, S]
-
def
header(k: String, v: String, replaceExisting: Boolean): RequestT[U, T, S]
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 dropped?
-
def
header(h: Header, replaceExisting: Boolean = false): RequestT[U, T, S]
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 dropped?
- def headers(hs: Header*): RequestT[U, T, S]
- def headers(hs: Map[String, String]): RequestT[U, T, S]
- val headers: Seq[Header]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def mapResponse[T2](f: (T) ⇒ T2): RequestT[U, T2, S]
- def maxRedirects(n: Int): RequestT[U, T, S]
- def method(method: Method, uri: Uri): Request[T, S]
- val method: U[Method]
- def multipartBody(p1: Part[BasicRequestBody], ps: Part[BasicRequestBody]*): RequestT[U, T, S]
- def multipartBody(ps: Seq[Part[BasicRequestBody]]): RequestT[U, T, S]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
openWebsocket[F[_], WS_HANDLER[_], WS_RESULT](handler: WS_HANDLER[WS_RESULT])(implicit backend: SttpBackend[F, S, WS_HANDLER], isIdInRequest: IsIdInRequest[U]): F[WebSocketResponse[WS_RESULT]]
Opens a websocket, using the backend from the implicit scope.
Opens a websocket, using the backend from the implicit scope. Only requests for which the method & URI are specified can be sent. The backend must support handlers of the given type.
- returns
Depending on the backend, either the WebSocketResponse (Identity synchronous backends), or the WebSocketResponse in a backend-specific wrapper, or a failed effect (other backends). Exceptions can be thrown directly (Identity synchronous backends), or wrapped (asynchronous backends). Known exceptions are converted by backends to one of SttpClientException. Other exceptions are thrown unchanged.
- def openWebsocketF[F[_], WS_HANDLER[_], WS_RESULT](handler: F[WS_HANDLER[WS_RESULT]])(implicit backend: SttpBackend[F, S, WS_HANDLER], isIdInRequest: IsIdInRequest[U]): F[WebSocketResponse[WS_RESULT]]
- def options(uri: Uri): Request[T, S]
- val options: RequestOptions
- def patch(uri: Uri): Request[T, S]
- def post(uri: Uri): Request[T, S]
- def proxyAuth: SpecifyAuthScheme[U, T, S]
- def put(uri: Uri): Request[T, S]
- def readTimeout(t: Duration): RequestT[U, T, S]
-
def
redirectToGet(r: Boolean): RequestT[U, T, S]
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.
-
def
response[T2, S2 >: S](ra: ResponseAs[T2, S2]): RequestT[U, T2, S2]
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. - val response: ResponseAs[T, S]
-
def
send[F[_]]()(implicit backend: SttpBackend[F, S, NothingT], 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.
- returns
Depending on the backend, either the Response (Identity synchronous backends), or the Response in a backend-specific wrapper, or a failed effect (other backends). The response body is deserialized as specified by this request (see RequestT.response). Exceptions can be thrown directly (Identity synchronous backends), or wrapped (asynchronous backends). Known exceptions are converted by backends to one of SttpClientException. Other exceptions are thrown unchanged.
- def streamBody[S2 >: S](b: S2): RequestT[U, T, S2]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def tag(k: String): Option[Any]
- def tag(k: String, v: Any): RequestT[U, T, S]
- val tags: Map[String, Any]
- def toCurl(implicit isIdInRequest: IsIdInRequest[U]): String
- val uri: U[Uri]
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )