Skip to content

Commit

Permalink
Fixes cemerick#19 - Prevent sorting of query params blowing up when s…
Browse files Browse the repository at this point in the history
…tring and keyword keys are used. Add test case.
  • Loading branch information
no-man-is-an-island committed Jan 7, 2016
1 parent a785b84 commit 9b98caa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cemerick/url.cljx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
(defn map->query
[m]
(some->> (seq m)
sort ; sorting makes testing a lot easier :-)
(map (fn [[k v]]
[(url-encode (name k))
"="
(url-encode (str v))]))
sort ; sorting makes testing a lot easier :-)
(interpose "&")
flatten
(apply str)))
Expand Down
1 change: 1 addition & 0 deletions test/cemerick/test_url.cljx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(deftest test-map-to-query-str
(are [x y] (= x (map->query y))
"a=1&b=2&c=3" {:a 1 :b 2 :c 3}
"a=1&b=2&c=3" {:a 1 "b" 2 :c 3}
"a=1&b=2&c=3" {:a "1" :b "2" :c "3"}
"a=1&b=2" {"a" "1" "b" "2"}
"a=" {"a" ""}))
Expand Down

0 comments on commit 9b98caa

Please sign in to comment.