tyrian.http

package tyrian.http

Type members

Classlikes

enum Body

The body of a request

The body of a request

final case class Header(name: String, value: String)

A request header

A request header

Value parameters:
name

header field name

value

header field value

object Http

An Error will be returned if something goes wrong with an HTTP request.

An Error will be returned if something goes wrong with an HTTP request.

enum Method

An HTTP method

An HTTP method

final case class Request[A](method: Method, headers: List[Header], url: String, body: Body, expect: Response[String] => Either[String, A], timeout: Option[FiniteDuration], withCredentials: Boolean)

Describes an HTTP request.

Describes an HTTP request.

Type parameters:
A

type of the successfully decoded response

Value parameters:
body

the request body (EmptyBody or StringBody(contentType: String, body: String))

expect

tries to transform a Response[String] to a value of type A

headers

a list of request headers

method

GET, POST, PUT, PATCH, DELETE, or OPTIONS

timeout

an optional timeout

url

the url

withCredentials

indicates if the request is using credentials

Companion:
object
object Request
Companion:
class
final case class Response[A](url: String, status: Status, headers: Map[String, String], body: A)

The response from an HTTP request.

The response from an HTTP request.

Type parameters:
A

type of the response body

Value parameters:
body

the response body

headers

the response headers

status

the status code

url

the url

final case class Status(code: Int, message: String)

The response status code

The response status code

Value parameters:
code

the status code

message

the status message