From 3748b72e6a2fe45bffe04e232ffa0788715b7735 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 13 May 2023 10:40:13 +0200 Subject: [PATCH] easier interface --- lib/net.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/net.ml b/lib/net.ml index 7023dc7..78cadae 100644 --- a/lib/net.ml +++ b/lib/net.ml @@ -5,5 +5,10 @@ let send_post_request url json = let headers = Cohttp.Header.init_with "Content-Type" "application/json" in let body = Cohttp_lwt.Body.of_string json in Lwt.bind (Client.post ~headers ~body uri) (fun (_response, body) -> - (* Lwt.map (fun body_str -> response, body_str) *) Cohttp_lwt.Body.to_string body) + Cohttp_lwt.Body.to_string body) +;; + +let execute_request url json = + let body = send_post_request url json in + Lwt_main.run body ;;