package client
Provides extension methods for using the a http4s org.http4s.client.Client
import scalaz.concurrent.Task import org.http4s._ import org.http4s.client._ import org.http4s.Http4s._ import org.http4s.Status._ import org.http4s.Method._ import org.http4s.EntityDecoder def client: Client = ??? val r: Task[String] = client(GET(uri("https://www.foo.bar/"))).as[String] val r2: DecodeResult[String] = client(GET(uri("https://www.foo.bar/"))).attemptAs[String] // implicitly resolve the decoder val req1 = r.run val req2 = r.run // Each invocation fetches a new Result based on the behavior of the Client
- Source
- package.scala
- Alphabetic
- By Inheritance
- client
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
final
case class
Client(open: Service[Request, DisposableResponse], shutdown: Task[Unit]) extends Product with Serializable
A Client submits Requests to a server and processes the Response.
- open
a service to asynchronously return a DisposableResponse from a Request. This is a low-level operation intended for client implementations and middleware.
- shutdown
a Task to shut down this Shutdown this client, closing any open connections and freeing resources
- trait Connection extends AnyRef
- type ConnectionBuilder[A <: Connection] = (RequestKey) ⇒ Task[A]
-
trait
ConnectionManager[A <: Connection] extends AnyRef
Type that is responsible for the client lifecycle
Type that is responsible for the client lifecycle
The ConnectionManager is a general wrapper around a ConnectionBuilder that can pool resources in order to conserve resources such as socket connections, CPU time, SSL handshakes, etc. Because it can contain significant resources it must have a mechanism to free resources associated with it.
-
final
case class
DisposableResponse(response: Response, dispose: Task[Unit]) extends Product with Serializable
Contains a Response that needs to be disposed of to free the underlying HTTP connection.
- type Middleware = (Client) ⇒ Client
- implicit final class NoBodySyntax extends AnyVal with EmptyRequestGenerator
-
final
case class
RequestKey(scheme: Scheme, authority: Authority) extends Product with Serializable
Represents a key for requests that can conceivably share a Connection.
- final case class UnexpectedStatus(status: Status) extends RuntimeException with NoStackTrace with Product with Serializable
-
implicit final
class
WithBodySyntax extends AnyVal with EntityRequestGenerator
Syntax classes to generate a request directly from a Method
Value Members
- implicit def wHeadersDec[T](implicit decoder: EntityDecoder[T]): EntityDecoder[(Headers, T)]
- object Client extends Serializable
- object ConnectionManager
- object RequestKey extends Serializable