GenericBackend
A specific implementation of HTTP request sending logic.
The send method '''should not''' be used directly by client code, if possible. Instead, the Request.send, StreamRequest.send, WebSocketRequest.send or WebSocketStreamRequest.send methods (depending on the type of the request) should be used, providing a specific backend instance as a parameter.
When creating an instance of a backend, one of the Backend traits should be mixed in, reflecting the effect type and the P
capabilities: Backend, SyncBackend, WebSocketBackend, WebSocketSyncBackend, StreamBackend, WebSocketStreamBackend. This is required in order to provide a better developer experience when sending requests: the resulting type has less type parameters.
Type parameters
- F
-
The effect type used to represent side-effects, such as obtaining the response for a request. 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), subtype of sttp.capabilities.Streams (the ability to send and receive streaming bodies) or WebSockets (the ability to handle websocket requests).
Attributes
- Note
-
Backends should try to classify known HTTP-related exceptions into one of the categories specified by SttpClientException. Other exceptions are thrown unchanged.
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class FetchBackendclass BackendStub[F]class SyncBackendStubobject SyncBackendStubclass WebSocketBackendStub[F]class WebSocketSyncBackendStubobject WebSocketSyncBackendStubtrait Backend[F]trait SyncBackendtrait WebSocketSyncBackendtrait WebSocketBackend[F]