diff --git a/bin/cohttp_curl_async.ml b/bin/cohttp_curl_async.ml index 9de25658a3..2c7162ba16 100644 --- a/bin/cohttp_curl_async.ml +++ b/bin/cohttp_curl_async.ml @@ -21,11 +21,11 @@ open Cohttp_async let show_headers h = Cohttp.Header.iter (fun k v -> List.iter v ~f:(Printf.eprintf "%s: %s\n%!" k)) h -let make_net_req uri meth' () = +let make_net_req uri meth' body () = let meth = Cohttp.Code.method_of_string meth' in let uri = Uri.of_string uri in let headers = Cohttp.Header.of_list [ "connection", "close" ] in - Client.call meth ~headers uri + Client.call meth ~headers ~body:Body.(of_string body) uri >>= fun (res, body) -> show_headers (Cohttp.Response.headers res); body @@ -38,7 +38,9 @@ let _ = (empty +> anon ("url" %: string) +> flag "-X" (optional_with_default "GET" string) - ~doc:" Set HTTP method" + ~doc:" Set HTTP method" + +> flag "data-binary" (optional_with_default "" string) + ~doc:" Data to send when using POST" ) make_net_req |> Command.run