Module Io.Net

val get_host : string -> string

get_host url extracts the host from the given url and returns it.

val get_path : string -> string

get_path url extracts the path from the given url and returns it.

val tls_config : Tls.Config.client
val empty_headers : Http.Header.t
type _ response =
  1. | Raw : ((Http.Response.t * Cohttp_eio.Body.t) -> 'a) -> 'a response
  2. | Default : string response
val post : 'a response -> net:_ Eio.Net.t -> host:string -> headers:Http.Header.t -> path:string -> string -> 'a

post res_typ ~net ~host ~headers ~path body sends an HTTP POST request with the given parameters and returns the response.

val get : 'a response -> net:_ Eio.Net.t -> host:string -> ?headers:Http.Header.t -> string -> 'a

get res_typ ~net ~host ?headers path sends an HTTP GET request with the given parameters and returns the response.

val download_file : _ Eio.Net.t -> string -> dir:Eio.Fs.dir_ty Eio.Path.t -> filename:string -> unit

download_file net url ~dir ~filename downloads the file from the given url and saves it to the specified dir and filename.