package yurt

  1. Overview
  2. Docs

Client contains functions for sending HTTP requests

val get : ?ctx:Cohttp_lwt_unix.Net.ctx -> ?headers:Header.t -> string -> (Response.t * string) Lwt.t

Send a GET request

val post : ?ctx:Cohttp_lwt_unix.Net.ctx -> ?headers:Header.t -> ?body:Body.t -> string -> (Response.t * string) Lwt.t

Send a POST request

val post_form : ?ctx:Cohttp_lwt_unix.Net.ctx -> ?headers:Header.t -> params:(string * string list) list -> string -> (Response.t * string) Lwt.t

Send a POST request with form encoded data

val request : ?ctx:Cohttp_lwt_unix.Net.ctx -> ?headers:Header.t -> ?body:Body.t -> Cohttp.Code.meth -> string -> (Response.t * string) Lwt.t

Send another type of request other than POST or GET

val get_json : ?ctx:Cohttp_lwt_unix.Net.ctx -> ?headers:Header.t -> string -> (Response.t * Ezjsonm.t) Lwt.t

Send a get request and return JSON response

val post_json : ?ctx:Cohttp_lwt_unix.Net.ctx -> ?headers:Header.t -> ?body:Body.t -> string -> (Response.t * Ezjsonm.t) Lwt.t

Send a post request and return JSON response

val post_form_json : ?ctx:Cohttp_lwt_unix.Net.ctx -> ?headers:Header.t -> ?params:(string * string list) list -> string -> (Response.t * Ezjsonm.t) Lwt.t

Send a POST request with from encoded data and return JSON response

OCaml

Innovation. Community. Security.