File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 3131(defn- error? [response]
3232 (>= (:code response) 400 ))
3333
34- (defn error-message [response]
34+ (defn- error-message [response]
3535 (str " Problem with " (:url response) " : "
3636 (:code response) " "
3737 (:msg response) " \n "
4444map. Cookies will be saved if inside with-cookies block." )
4545 [u# & [headers# body#]]
4646 (let [response# (save-cookies (client/request u# ~(str method)
47- headers# *cookies* body#))]
47+ headers# (if *cookies*
48+ @*cookies*)
49+ body#))]
4850 (if (error? response#)
4951 (throw (java.io.IOException. (error-message response#)))
5052 response#))))
@@ -56,8 +58,9 @@ map. Cookies will be saved if inside with-cookies block.")
5658(define-method head )
5759
5860(defmacro with-cookies
59- " Perform body with *cookies* bound to cookie-map. Responses that set
60- cookies will have them saved in the *cookies* ref."
61+ " Perform body with *cookies* bound to cookie-map (should be a map;
62+ empty if you don't want any initial cookies). Responses that set cookies
63+ will have them saved in the *cookies* ref."
6164 [cookie-map & body]
62- `(binding [*cookies* (ref (or cookie-map {}))]
65+ `(binding [*cookies* (ref (or ~ cookie-map {}))]
6366 ~@body))
You can’t perform that action at this time.
0 commit comments