Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/clj_http/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,8 @@
(conn/shutdown-manager conn-mgr))
(throw t))))
(let [^CloseableHttpAsyncClient client
(build-async-http-client req conn-mgr http-url proxy-ignore-hosts)
(or http-client
(build-async-http-client req conn-mgr http-url proxy-ignore-hosts))
original-thread-bindings (clojure.lang.Var/getThreadBindingFrame)]
(when cache?
(throw (IllegalArgumentException.
Expand Down
8 changes: 6 additions & 2 deletions test/clj_http/test/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,9 @@
:async true}
(fn [resp]
(is (= 200 (:status resp)))
(is (= {:foo "bar"} (:body resp))))
(is (= {:foo "bar"} (:body resp)))
(is (= hc (:http-client resp))
"http-client is correctly reused"))
(fn [e] (is false (str "failed with " e)))))
(let [cm (conn/make-reusable-conn-manager {})
hc (:http-client (client/get (localhost "/get")
Expand All @@ -893,7 +895,9 @@
:http-client hc
:as :json})]
(is (= 200 (:status resp)))
(is (= {:foo "bar"} (:body resp)))))
(is (= {:foo "bar"} (:body resp)))
(is (= hc (:http-client resp))
"http-client is correctly reused")))

(deftest ^:integration t-cookies-spec
(run-server)
Expand Down