Module B0_web.Http
HTTP requests.
HTTP requests via curl.
HTTP methods and headers
type meth=[|`CONNECT|`DELETE|`GET|`HEAD|`OPTIONS|`Other of string|`PATCH|`POST|`PUT|`TRACE]The type for HTTP methods.
val meth_to_string : meth -> stringmeth_to_string mis a string representation ofm.
HTTP requests
val req : ?headers:headers -> ?body:string -> uri:string -> meth -> reqreq uri m ~headers ~bodyis a request onuriwith methodm, headersheaders(defaults to[]) and bodybody(defaults to"").
val req_uri : req -> stringreq_uri risr's request URI.
val req_body : req -> stringreq_body risr's body.
HTTP responses
val resp_status : resp -> intresp_status ris the HTTP response status.
val resp_body : resp -> stringresp_body ris the HTTP response body.
Performing requests
val curl : ?docs:string -> ?env:Cmdliner.Arg.env -> unit -> B0_std.Cmd.t Cmdliner.Term.tcurlis 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.resultval perform : ?follow:bool -> t -> req -> (resp, string) Stdlib.resultperform curl rperforms requestrviacurlwhich is looked up in the PATH or in the environment variableB0_CURL. Iffollowistrue(default) HTTP redirects for GET and HEAD requests that return 301, 302, 303, 305 or 307 are automatically followed.