From 3777bdff1c1ac76dca9e217a05839896fdb6af1e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 13 May 2023 10:40:03 +0200 Subject: [PATCH] payload to json --- bin/main.ml | 18 +++--------------- lib/dune | 2 +- lib/json.ml | 13 +++++++++++++ 3 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 lib/json.ml diff --git a/bin/main.ml b/bin/main.ml index 9edd6ac..beb65db 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1,23 +1,11 @@ open Pusk.Utils +open Pusk open Pusk.Net open Pusk.Drivers let main = - let json_payload = - {| - { - "capabilities": { - "alwaysMatch": { - "moz:firefoxOptions": { - "args": ["-headless"] - } - } - } - } - |} - in - let body = send_post_request "http://localhost:4444/session" json_payload in - print_endline (Lwt_main.run body) + let body = execute_request "http://localhost:4444/session" Json.connection_payload in + print_endline body ;; let () = diff --git a/lib/dune b/lib/dune index 01daeb5..06f86ac 100644 --- a/lib/dune +++ b/lib/dune @@ -1,4 +1,4 @@ (library (name pusk) - (modules utils drivers net) + (modules utils drivers net json) (libraries cohttp-lwt-unix)) diff --git a/lib/json.ml b/lib/json.ml new file mode 100644 index 0000000..ee91cd6 --- /dev/null +++ b/lib/json.ml @@ -0,0 +1,13 @@ +let connection_payload = + {| + { + "capabilities": { + "alwaysMatch": { + "moz:firefoxOptions": { + "args": ["-headless"] + } + } + } + } + |} +;;