A batteries included HTTP/1.1 client in OCaml
1(* Simple test to isolate the issue - tests One module directly *)
2let () =
3 Logs.set_level (Some Logs.Debug);
4 Logs.set_reporter (Logs_fmt.reporter ());
5 Eio_main.run @@ fun env ->
6 Mirage_crypto_rng_unix.use_default ();
7 Eio.Switch.run @@ fun sw ->
8 Printf.printf "Making simple_head request...\n%!";
9 try
10 let response = Requests.simple_head ~sw env "https://opam.ocaml.org" in
11 Printf.printf "Status: %d\n%!" (Requests.Response.status_code response)
12 with e ->
13 Printf.printf "Exception: %s\n%!" (Printexc.to_string e);
14 Printexc.print_backtrace stdout