SttpBackend

trait SttpBackend[F[_], +P]

A backend is used to send HTTP requests described by RequestT. Backends might wrap Java or Scala HTTP clients, or other backends.

A backend is used to send HTTP requests described by RequestT. Backends might wrap Java or Scala HTTP clients, or other backends.

Type Params
F

The effect type used when returning responses. E.g. Identity for synchronous backends, scala.concurrent.Future for asynchronous backends.

P

Capabilities supported by this backend, in addition to Effect. This might be Any (no special capabilities), Streams (the ability to send and receive streaming bodies) or WebSockets (the ability to handle websocket requests).

Note

Backends should try to classify exceptions into one of the categories specified by SttpClientException. Other exceptions should be thrown unchanged.

class Object
trait Matchable
class Any

Value members

Abstract methods

def close(): F[Unit]
def responseMonad: MonadError[F]

A monad instance for the effect type used when returning responses. Allows writing wrapper backends, which map/flatMap over the return value of send.

A monad instance for the effect type used when returning responses. Allows writing wrapper backends, which map/flatMap over the return value of send.

def send[T, R >: P & Effect[F]](request: Request[T, R]): F[Response[T]]
Type Params
R

The capabilities required by the request. This must be a subset of the the capabilities supported by the backend (which always includes Effect[F]).