package cohttp-lwt

  1. Overview
  2. Docs

Parameters

module IO : S.IO
module Net : S.Net with module IO = IO

Signature

type ctx = Net.ctx
val call : ?ctx:ctx -> ?headers:Cohttp.Header.t -> ?body:Body.t -> ?chunked:bool -> Cohttp.Code.meth -> Uri.t -> (Cohttp.Response.t * Body.t) Lwt.t

call ?ctx ?headers ?body ?chunked meth uri will resolve the uri to a concrete network endpoint using context ctx. It will then issue an HTTP request with method meth, adding request headers from headers if present. If a body is specified then that will be included with the request, using chunked encoding if chunked is true. The default is to disable chunked encoding for HTTP request bodies for compatibility reasons.

In most cases you should use the more specific helper calls in the interface rather than invoke this function directly. See head, get and post for some examples.

Depending on ctx, the library is able to send a simple HTTP request or an encrypted one with a secured protocol (such as TLS). Depending on how conduit is configured, ctx might initiate a secured connection with TLS (using ocaml-tls) or SSL (using ocaml-ssl), on *:443 or on the specified port by the user. If neitehr ocaml-tls or ocaml-ssl are installed on the system, cohttp/conduit tries the usual (*:80) or the specified port by the user in a non-secured way.

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 * Body.t) Lwt.t
val delete : ?ctx:ctx -> ?body:Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Body.t) Lwt.t
val post : ?ctx:ctx -> ?body:Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Body.t) Lwt.t
val put : ?ctx:ctx -> ?body:Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Body.t) Lwt.t
val patch : ?ctx:ctx -> ?body:Body.t -> ?chunked:bool -> ?headers:Cohttp.Header.t -> Uri.t -> (Cohttp.Response.t * Body.t) Lwt.t
val post_form : ?ctx:ctx -> ?headers:Cohttp.Header.t -> params:(string * string list) list -> Uri.t -> (Cohttp.Response.t * Body.t) Lwt.t
val callv : ?ctx:ctx -> Uri.t -> (Cohttp.Request.t * Body.t) Lwt_stream.t -> (Cohttp.Response.t * Body.t) Lwt_stream.t Lwt.t
OCaml

Innovation. Community. Security.