Skip to content

Commit

Permalink
add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Apr 18, 2024
1 parent 0e06738 commit 108fda2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/babashka/http_client_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,18 @@
"q=%26moo"))))))

(deftest ring-client-test
(let [resp (http/get "https://clojure.org"
{:client (fn [req]
{:body (java.io.ByteArrayInputStream. (.getBytes "Hello"))
:clojure (= "https://clojure.org" (str (:uri req)))})})]
(is (:clojure resp))
(is (= "Hello" (:body resp)))))
(testing "string body"
(let [resp (http/get "https://clojure.org"
{:client (fn [_req]
{:body "Hello"})})]
(is (= "Hello" (:body resp)))))
(testing "inputstring body"
(let [resp (http/get "https://clojure.org"
{:client (fn [req]
{:body (java.io.ByteArrayInputStream. (.getBytes "Hello"))
:clojure (= "https://clojure.org" (str (:uri req)))})})]
(is (:clojure resp))
(is (= "Hello" (:body resp))))))

(comment
(run-server)
Expand Down

0 comments on commit 108fda2

Please sign in to comment.