gleamunison/http_client

Types

pub type HttpError {
  HttpError(reason: String)
}

Constructors

  • HttpError(reason: String)
pub opaque type HttpResponse

Values

pub fn body(resp: HttpResponse) -> BitArray
pub fn headers(resp: HttpResponse) -> List(#(String, String))
pub fn post_with_headers(
  url: String,
  headers: List(#(String, String)),
  body: BitArray,
) -> Result(HttpResponse, HttpError)
pub fn request(
  method: String,
  url: String,
  headers: List(#(String, String)),
  body: BitArray,
) -> Result(HttpResponse, HttpError)

Header-aware request — the general form, and the single convenience wrapper over request_with_options (default timeout, no cancellation).

pub fn request_with_options(
  method: String,
  url: String,
  headers: List(#(String, String)),
  body: BitArray,
  timeout_ms: Int,
  cancellation: option.Option(cancellation.Token),
) -> Result(HttpResponse, HttpError)
pub fn status(resp: HttpResponse) -> Int
✨ Search Document