My agentic slop goes here. Not intended for anyone else!
1(** Simple test to check if multiple HTTPS requests work *)
2
3let () =
4 let () = Mirage_crypto_rng_unix.use_default () in
5
6 Eio_main.run @@ fun env ->
7 Eio.Switch.run @@ fun sw ->
8
9 Printf.printf "Creating Requests client...\n%!";
10 let requests = Requests.create ~sw env in
11
12 Printf.printf "Making first HTTPS request to api.fastmail.com...\n%!";
13 let resp1 = Requests.get requests ~timeout:(Requests.Timeout.create ~total:10.0 ()) "https://api.fastmail.com/jmap/session" in
14 Printf.printf " Status: %d\n%!" (Requests.Response.status_code resp1);
15
16 (* Drain body *)
17 let buf1 = Buffer.create 4096 in
18 Eio.Flow.copy (Requests.Response.body resp1) (Eio.Flow.buffer_sink buf1);
19 Printf.printf " Body length: %d\n%!" (Buffer.length buf1);
20
21 Printf.printf "Making second HTTPS request to api.fastmail.com...\n%!";
22 let resp2 = Requests.get requests ~timeout:(Requests.Timeout.create ~total:10.0 ()) "https://api.fastmail.com/jmap/session" in
23 Printf.printf " Status: %d\n%!" (Requests.Response.status_code resp2);
24
25 Printf.printf "✓ Both requests succeeded!\n"