sttp
Client backed by sttp.
The Endpoints
interpreter is parameterized by an sttp backend of type SttpBackend[R, Nothing]
, for some type constructor R[_]
.
The Endpoint[A, B]
type is fixed as follows:
sourcecase class Endpoint[A, B](request: Request[A], response: Response[B])
extends (A => R[B])
This means that, given the following endpoint definition:
sourceval someResource: Endpoint[Int, String] =
endpoint(get(path / "some-resource" / segment[Int]()), ok(textResponse))
It can be invoked as follows with the HttpURLConnectionBackend
, for instance:
sourceval string: String = someResource(42)
1.12.1