HttpClient

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

Attributes

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

Members list

Value members

Concrete methods

def appendParams(params: (String, String)*): HttpClient
def call[Response : RW]: 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.

Type parameters

Response

the response type

Attributes

Returns

Response

def callTry[Response : RW]: 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.

Type parameters

Response

the response type

Attributes

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.

Value parameters

content

the content to set

Attributes

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.

Value parameters

content

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

Attributes

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 interceptor(interceptor: Interceptor): HttpClient
def json(json: Json): HttpClient

Convenience method to sending JSON content.

Convenience method to sending JSON content.

Value parameters

json

the JSON content to send

Attributes

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 : RW, Response : RW](request: Request): IO[Response]
def restfulEither[Request : RW, Success : RW, Failure : RW](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.

Type parameters

Failure

the failure (non-OK response) response type

Request

the request type

Success

the success (OK response) response type

Value parameters

request

the request object to convert to JSON and send

Attributes

Returns

either Failure or Success

def restfulTry[Request : RW, Response : RW](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.

Type parameters

Request

the request type

Response

the response type

Value parameters

request

the request object to convert to JSON and send

Attributes

Returns

Future[Response]

def saveDirectory(saveDirectory: String): HttpClient
final def send(): IO[HttpResponse]
final def sendTry(): 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 sessionManager(sessionManager: SessionManager): 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