easier interface
This commit is contained in:
parent
3777bdff1c
commit
3748b72e6a
1 changed files with 6 additions and 1 deletions
|
@ -5,5 +5,10 @@ let send_post_request url json =
|
||||||
let headers = Cohttp.Header.init_with "Content-Type" "application/json" in
|
let headers = Cohttp.Header.init_with "Content-Type" "application/json" in
|
||||||
let body = Cohttp_lwt.Body.of_string json in
|
let body = Cohttp_lwt.Body.of_string json in
|
||||||
Lwt.bind (Client.post ~headers ~body uri) (fun (_response, body) ->
|
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
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue