Skip to content

Commit 12242fb

Browse files
committed
Re-add support for specifying CookieStore in *cookie-store*
Relates to dakrone#318
1 parent 3571ba0 commit 12242fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/clj_http/core.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@
166166
(def proxy-move-with-body (make-proxy-method-with-body :move))
167167
(def proxy-patch-with-body (make-proxy-method-with-body :patch))
168168

169+
(def ^:dynamic *cookie-store* nil)
170+
169171
(defn make-proxy-method [method url]
170172
(doto (proxy [HttpRequestBase] []
171173
(getMethod
@@ -273,8 +275,8 @@
273275
request-method http-url body)]
274276
(when-not (conn/reusable? conn-mgr)
275277
(.addHeader http-req "Connection" "close"))
276-
(when cookie-store
277-
(.setCookieStore context cookie-store))
278+
(when-let [cookie-jar (or cookie-store *cookie-store*)]
279+
(.setCookieStore context cookie-jar))
278280
(when-let [[user pass] digest-auth]
279281
(.setCredentialsProvider
280282
context

0 commit comments

Comments
 (0)