HttpClient

spice.http.client.HttpClient
See theHttpClient companion object
case class HttpClient(request: HttpRequest, implementation: HttpClientImplementation, retries: Int, retryDelay: FiniteDuration, interceptor: Interceptor, saveDirectory: String, timeout: FiniteDuration, pingInterval: Option[FiniteDuration], dns: DNS, dropNullValuesInJson: Boolean, sessionManager: Option[SessionManager], failOnHttpStatus: Boolean, validateSSLCertificates: Boolean, proxy: Option[Proxy])

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Known subtypes
object HttpClient.type

Members list

Concise view

Value members

Concrete methods

def appendParams(params: (String, String)*): HttpClient
def call[Response : Writer]: IO[Response]

Builds on the send method by supporting basic restful calls that calls a URL and returns a case class as the response.

Builds on the send method by supporting basic restful calls that calls a URL and returns a case class as the response.

Attributes

Response

the response type

Returns:

Response

def callTry[Response : Writer]: IO[Try[Response]]

Builds on the send method by supporting basic restful calls that calls a URL and returns a case class as the response.

Builds on the send method by supporting basic restful calls that calls a URL and returns a case class as the response.

Attributes

Response

the response type

Returns:

Try[Response]

def content(content: Content): HttpClient

Sets the content to be sent. If this request is set to GET, it will automatically be changed to POST.

Sets the content to be sent. If this request is set to GET, it will automatically be changed to POST.

Attributes

content

the content to set

Returns:

HttpClient

def content(content: Option[Content]): HttpClient

Sets the content to be sent optionally. If this request is set to GET, it will automatically be changed to POST.

Sets the content to be sent optionally. If this request is set to GET, it will automatically be changed to POST.

Attributes

content

the content to set - if None, nothing will be changed

Returns:

HttpClient

def dispose(): IO[Unit]
def dns(dns: DNS): HttpClient
def dropNullValuesInJson(dropNullValuesInJson: Boolean): HttpClient
def failOnHttpStatus(failOnHttpStatus: Boolean): HttpClient
def header(header: Header): HttpClient
def header(key: String, value: String): HttpClient
def headers(headers: Headers, replace: Boolean): HttpClient
def json(json: Json): HttpClient

Convenience method to sending JSON content.

Convenience method to sending JSON content.

Attributes

json

the JSON content to send

Returns:

HttpClient

def method: HttpMethod
def method(method: HttpMethod): HttpClient
def modify(f: HttpRequest => HttpRequest): HttpClient
def param[T](name: String, value: T, default: T): HttpClient
def params(params: (String, String)*): HttpClient
def path: URLPath
def path(path: URLPath, append: Boolean): HttpClient
def pingInterval(pingInterval: Option[FiniteDuration]): HttpClient
def proxy(proxy: Proxy): HttpClient
def removeHeader(key: String): HttpClient
def restful[Request : Reader, Response : Writer](request: Request): IO[Response]
def restfulEither[Request : Reader, Success : Writer, Failure : Writer](request: Request): IO[Either[Failure, Success]]

Similar to the restful call, but provides a different return-type if the response is an error.

Similar to the restful call, but provides a different return-type if the response is an error.

Attributes

Failure

the failure (non-OK response) response type

Request

the request type

Success

the success (OK response) response type

request

the request object to convert to JSON and send

Returns:

either Failure or Success

def restfulTry[Request : Reader, Response : Writer](request: Request): IO[Try[Response]]

Builds on the send method by supporting basic restful calls that take a case class as the request and returns a case class as the response.

Builds on the send method by supporting basic restful calls that take a case class as the request and returns a case class as the response.

Attributes

Request

the request type

Response

the response type

request

the request object to convert to JSON and send

Returns:

Future[Response]

def retries(retries: Int): HttpClient
def retryDelay(retryDelay: FiniteDuration): HttpClient
def saveDirectory(saveDirectory: String): HttpClient
final def send(retries: Int): IO[HttpResponse]
final def sendTry(retries: Int): IO[Try[HttpResponse]]

Sends an HttpRequest and receives an asynchronous HttpResponse future.

Sends an HttpRequest and receives an asynchronous HttpResponse future.

Attributes

Returns:

Future[HttpResponse]

def session(session: Session): HttpClient
def timeout(timeout: FiniteDuration): HttpClient
def url: URL
def url(url: URL): HttpClient
def webSocket(): WebSocket

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product