Module B0_http.Httpr

HTTP requests via curl.

Performing requests

type t

The type for HTTP requestors.

val curl : ?⁠docs:string -> ?⁠env:Cmdliner.Arg.env -> unit -> B0_std.Cmd.t Cmdliner.Term.t

curl is a cli interface for specifying the curl command line tool.

val find_curl : ?⁠search:B0_std.Fpath.t list -> curl:B0_std.Cmd.t -> unit -> (t, string) Stdlib.result
val perform : ?⁠follow:bool -> t -> Http.req -> (Http.resp, string) Stdlib.result

perform curl r performs request r via curl which is looked up in the PATH or in the environment variable B0_CURL. If follow is true (default) HTTP redirects for GET and HEAD requests that return 301, 302, 303, 305 or 307 are automatically followed.

The response's Http.resp_headers are lowercased.