package cohttp-lwt-unix

  1. Overview
  2. Docs

The Client module implements the full UNIX HTTP client interface, including the UNIX-specific functions defined in C.

include Cohttp_lwt.S.Client with type ctx = Cohttp_lwt_unix__.Net.ctx
type ctx = Net.ctx
val sexp_of_ctx : ctx -> Ppx_sexp_conv_lib.Sexp.t
val default_ctx : ctx
val call : ?ctx:ctx -> ?headers:Cohttp.Header.t -> ?body:Cohttp_lwt__.Body.t -> ?chunked:bool -> Cohttp.Code.meth -> Uri.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt.t
val head : ?ctx:ctx -> ?headers:Cohttp.Header.t -> Uri.t -> Cohttp.Response.t Lwt.t
val get : ?ctx:ctx -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt.t
val delete : ?ctx:ctx -> ?body:Cohttp_lwt__.Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt.t
val post : ?ctx:ctx -> ?body:Cohttp_lwt__.Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt.t
val put : ?ctx:ctx -> ?body:Cohttp_lwt__.Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt.t
val patch : ?ctx:ctx -> ?body:Cohttp_lwt__.Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt.t
val post_form : ?ctx:ctx -> ?headers:Cohttp.Header.t -> params:(string * string list) list -> Uri.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt.t
val callv : ?ctx:ctx -> Uri.t -> (Cohttp.Request.t * Cohttp_lwt__.Body.t) Lwt_stream.t -> (Cohttp.Response.t * Cohttp_lwt__.Body.t) Lwt_stream.t Lwt.t
val custom_ctx : ?ctx:Conduit_lwt_unix.ctx -> ?resolver:Resolver_lwt.t -> unit -> ctx

custom_ctx ?ctx ?resolver () will return a context that is the same as the default_ctx, but with either the connection handling or resolution module overridden with ctx or resolver respectively.

This is useful to supply a Conduit_lwt_unix.ctx with a custom source network interface, or a Resolver_lwt.t with a different name resolution strategy (for instance to override a hostname to point it to a Unix domain socket).

OCaml

Innovation. Community. Security.