SimpleHttpClient

sttp.client3.SimpleHttpClient
See theSimpleHttpClient companion object
case class SimpleHttpClient(backend: SttpBackend[Future, Any])

A simple, synchronous http client. Usage example:

import sttp.client3.{SimpleHttpClient, UriContext, basicRequest}

val client = SimpleHttpClient()
val request = basicRequest.get(uri"https://httpbin.org/get")
val response = client.send(request)
response.map(r => println(r.body))

Wraps an SttpBackend, which can be substituted or modified using wrapBackend, adding e.g. logging.

Creating a client allocates resources, hence when no longer needed, the client should be closed using close.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def close(): Future[Unit]
def send[T](request: Request[T, Any]): Future[Response[T]]
def withBackend(newBackend: SttpBackend[Future, Any]): SimpleHttpClient
def wrapBackend(f: SttpBackend[Future, Any] => SttpBackend[Future, Any]): SimpleHttpClient

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product