easier interface

This commit is contained in:
Mylloon 2023-05-13 10:40:13 +02:00
parent 3777bdff1c
commit 3748b72e6a
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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
;;