Skip to content

Commit

Permalink
Fix generate-query-string to handle sequential values properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Baishampayan Ghose committed Jan 23, 2012
1 parent 95d8e81 commit da97805
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/clj_http/client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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}]
Expand Down

0 comments on commit da97805

Please sign in to comment.