package cohttp-eio

  1. Overview
  2. Docs

Module Cohttp_eio.ClientSource

Sourcetype t
include Cohttp.Generic.Client.S with type 'a with_context = t -> sw:Eio.Std.Switch.t -> 'a and type 'a io = 'a and type body = Body.t
Sourcetype 'a io = 'a
Sourcetype 'a with_context = t -> sw:Eio.Std.Switch.t -> 'a
Sourcetype body = Body.t
Sourceval map_context : 'a with_context -> ('a -> 'b) -> 'b with_context
Sourceval call : (?headers:Http.Header.t -> ?body:body -> ?chunked:bool -> Http.Method.t -> Uri.t -> (Http.Response.t * body) io) with_context

call ?headers ?body ?chunked meth uri

  • returns

    (response, response_body) Consume response_body in a timely fashion. Please see call about how and why.

  • parameter chunked

    use chunked encoding if true. The default is false for compatibility reasons.

Sourceval delete : (?body:body -> ?chunked:bool -> ?headers:Http.Header.t -> Uri.t -> (Http.Response.t * body) io) with_context
Sourceval post : (?body:body -> ?chunked:bool -> ?headers:Http.Header.t -> Uri.t -> (Http.Response.t * body) io) with_context
Sourceval put : (?body:body -> ?chunked:bool -> ?headers:Http.Header.t -> Uri.t -> (Http.Response.t * body) io) with_context
Sourceval patch : (?body:body -> ?chunked:bool -> ?headers:Http.Header.t -> Uri.t -> (Http.Response.t * body) io) with_context
Sourceval make : https: (Uri.t -> [ `Generic ] Eio.Net.stream_socket_ty Eio.Std.r -> _ Eio.Flow.two_way) option -> _ Eio.Net.t -> t

make ~https net is a convenience wrapper around make_generic that uses net to make connections.

  • URIs of the form "http://host:port/..." connect to the given TCP host and port.
  • URIs of the form "https://host:port/..." connect to the given TCP host and port, and are then wrapped by https (or rejected if that is None).
  • URIs of the form "httpunix://unix-path/http-path" connect to the given Unix path.
Sourceval make_generic : (sw:Eio.Std.Switch.t -> Uri.t -> _ Eio.Flow.two_way) -> t

make_generic connect is an HTTP client that uses connect to get the connection to use for a given URI.

OCaml

Innovation. Community. Security.