http-mirage-client/src/http_mirage_client.mli

44 lines
1.2 KiB
OCaml
Raw Normal View History

type t
2022-10-05 11:58:07 +00:00
module type S = sig
type nonrec t = t
val connect : Mimic.ctx -> t Lwt.t
2022-10-05 11:58:07 +00:00
end
module Make
2022-10-19 09:49:27 +00:00
(Pclock : Mirage_clock.PCLOCK)
(TCP : Tcpip.Tcp.S)
(Happy_eyeballs : Mimic_happy_eyeballs.S with type flow = TCP.flow) : S
2022-10-05 11:58:07 +00:00
module Version = Httpaf.Version
module Status = H2.Status
module Headers = H2.Headers
2022-10-19 09:49:27 +00:00
type response = {
version: Version.t
; status: Status.t
; reason: string
; headers: Headers.t
}
2022-10-05 11:58:07 +00:00
2022-10-27 11:21:24 +00:00
val request :
2022-10-19 09:49:27 +00:00
?config:[ `H2 of H2.Config.t | `HTTP_1_1 of Httpaf.Config.t ]
-> ?tls_config:Tls.Config.client
-> t
-> ?authenticator:X509.Authenticator.t
-> ?meth:Httpaf.Method.t
-> ?headers:(string * string) list
-> ?body:string
-> ?max_redirect:int
-> ?follow_redirect:bool
-> string
2022-10-27 18:51:42 +00:00
-> (response -> 'a -> string -> 'a Lwt.t)
2022-10-27 11:21:24 +00:00
-> 'a
-> (response * 'a, [> Mimic.error ]) result Lwt.t
2022-10-27 18:59:49 +00:00
(** [request ~config ~tls_config t ~authenticator ~meth ~headers ~body
~max_redirect ~follow_redirect url body_f body_init] does a HTTP request
to [url] using [meth] and the HTTP protocol in [config]. The response is
the value of this function. The body is provided in chunks (see [body_f]).
Reasonably defaults are used if not provided. *)