Permalink
Browse files

Fix generate-query-string to handle sequential values properly.

  • Loading branch information...
1 parent 95d8e81 commit da9780506f5137bd8aeaefbe71ca0ed8e0403caa @ghoseb committed Jan 23, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/clj_http/client.clj
View
@@ -126,9 +126,17 @@
(defn generate-query-string [params]
(str/join "&"
- (map (fn [[k v]] (str (util/url-encode (name k)) "="
- (util/url-encode (str v))))
- params)))
+ (mapcat (fn [[k v]]
+ (if (sequential? v)
+ (map #(str (util/url-encode (name %1))
+ "="
+ (util/url-encode (str %2)))
+ (repeat k) v)
+ [(str (util/url-encode (name k))
+ "="
+ (util/url-encode (str v)))]))
+ params)))
+
(defn wrap-query-params [client]
(fn [{:keys [query-params] :as req}]

0 comments on commit da97805

Please sign in to comment.