Skip to content

Commit

Permalink
No reason for *cookies* to be a ref.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Jun 14, 2010
1 parent cc61cb1 commit 107e68a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/clojure_http/resourcefully.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

(defn- save-cookies [response]
(when (and *cookies* (:cookies response))
(dosync (alter *cookies* merge (:cookies response))))
(swap! *cookies* merge (:cookies response)))
response)

(defn- error? [response]
Expand Down Expand Up @@ -56,7 +56,7 @@ Cookies will be saved if inside with-cookies block.")
(defmacro with-cookies
"Perform body with *cookies* bound to cookie-map (should be a map;
empty if you don't want any initial cookies). Responses that set cookies
will have them saved in the *cookies* ref."
will have them saved in the *cookies* atom."
[cookie-map & body]
`(binding [*cookies* (ref (or ~cookie-map {}))]
`(binding [*cookies* (atom (or ~cookie-map {}))]
~@body))

0 comments on commit 107e68a

Please sign in to comment.