Describes how response body should be handled.
Apart from the basic cases (ignoring, reading as a byte array or file), response body descriptions can be mapped over, to support custom types. The mapping can take into account the ResponseMetadata, that is the headers and status code. Responses can also be handled depending on the response metadata. Finally, two response body descriptions can be combined (with some restrictions).
A number of as[Type]
helper methods are available as part of SttpApi and when importing sttp.client3._
.
- Type Params
- R
The backend capabilities required by the 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 WebSockets (the ability to handle websocket requests).- T
Target type as which the response will be read.
- Companion
- object
Value members
Abstract methods
Concrete methods
If the type to which the response body should be deserialized is an Either[ResponseException[HE, DE], B]
,
either throws the DeserializationException, returns the deserialized body from the HttpError, or the
deserialized successful body B
.
If the type to which the response body should be deserialized is an Either[ResponseException[HE, DE], B]
,
either throws the DeserializationException, returns the deserialized body from the HttpError, or the
deserialized successful body B
.
If the type to which the response body should be deserialized is an Either[A, B]
:
If the type to which the response body should be deserialized is an Either[A, B]
:
- in case of
A
, throws as an exception / returns a failed effect (wrapped with an HttpError ifA
is not yet an exception) - in case of
B
, returns the value directly