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 delete(url: String) -> Result(HttpResponse, HttpError)
pub fn get(url: String) -> Result(HttpResponse, HttpError)
pub fn headers(resp: HttpResponse) -> List(#(String, String))
pub fn post(
  url: String,
  body: BitArray,
) -> Result(HttpResponse, HttpError)
pub fn post_with_headers(
  url: String,
  headers: List(#(String, String)),
  body: BitArray,
) -> Result(HttpResponse, HttpError)
pub fn put(
  url: 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; get/post/put/delete are the no-header conveniences preserved for existing callers.

pub fn status(resp: HttpResponse) -> Int
✨ Search Document