Module Ezcurl_core

Core signatures and implementation

module Config : sig ... end

Configuration for the client.

type t = Curl.t

A client, i.e. a cURL instance.

val make : ?set_opts:(t -> unit) -> unit -> t

Create a new client.

  • parameter set_opts

    called before returning the client, to set options

val delete : t -> unit

Delete the client. It cannot be used anymore.

val with_client : ?set_opts:(t -> unit) -> (t -> 'a) -> 'a

Make a temporary client, call the function with it, then cleanup.

type response_info = {
  1. ri_response_time : float;
    (*

    Total time (in seconds) for the request/response pair. See Curl.get_totaltime.

    *)
  2. ri_redirect_count : int;
    (*

    Number of redirects cURL followed. See Curl.get_redirectcount.

    *)
}

Metadata about a response from the server.

val pp_response_info : Stdlib.Format.formatter -> response_info -> unit
val string_of_response_info : response_info -> string
type response = {
  1. code : int;
    (*

    Response code. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

    *)
  2. headers : (string * string) list;
    (*

    Response headers

    *)
  3. body : string;
    (*

    Response body, or ""

    *)
  4. info : response_info;
    (*

    Information about the response

    *)
}

Response for a given request.

val pp_response : Stdlib.Format.formatter -> response -> unit
val string_of_response : response -> string
type meth =
  1. | GET
  2. | POST of Curl.curlHTTPPost list
  3. | PUT
  4. | DELETE
  5. | HEAD
  6. | CONNECT
  7. | OPTIONS
  8. | TRACE
  9. | PATCH

The HTTP method to use

val pp_meth : Stdlib.Format.formatter -> meth -> unit
val string_of_meth : meth -> string
module type IO = sig ... end
module type S = sig ... end
module Make (IO : IO) : S with type 'a io = 'a IO.t