Skip to content

Commit

Permalink
Fix for specifying querystring without extra params
Browse files Browse the repository at this point in the history
The bug was introduced in the move to ring-codec as the nil
behaviour differed in form-encode
  • Loading branch information
glenjamin committed May 23, 2013
1 parent 4bc9bd1 commit 112f862
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ring/mock/request.clj
Expand Up @@ -9,7 +9,8 @@
(defn- encode-params
"Turn a map of parameters into a urlencoded string."
[params]
(codec/form-encode params))
(if params
(codec/form-encode params)))

(defn header
"Add a HTTP header to the request map."
Expand Down
3 changes: 3 additions & 0 deletions test/ring/mock/test/request.clj
Expand Up @@ -35,6 +35,9 @@
(is (= (slurp body) "quux=zot"))))
(testing "nil path"
(is (= (:uri (request :get "http://example.com")) "/")))
(testing "only params in :get"
(is (= (:query-string (request :get "/?a=b"))
"a=b")))
(testing "added params in :get"
(is (= (:query-string (request :get "/" (array-map :x "y" :z "n")))
"x=y&z=n"))
Expand Down

0 comments on commit 112f862

Please sign in to comment.