Permalink
Browse files

Correctly handle non-string param values in keyword params middleware.

  • Loading branch information...
1 parent 459d732 commit b64a5207e063d26726fcb6e5e699eabc25ced66e @mmcgrana committed Jul 30, 2010
View
6 ring-core/src/ring/middleware/keyword_params.clj
@@ -3,16 +3,16 @@
(defn- keyify-params [target]
(cond
- (string? target)
- target
(map? target)
(reduce
(fn [m [k v]]
(assoc m (keyword k) (keyify-params v)))
{}
target)
(vector? target)
- (vec (map keyify-params target))))
+ (vec (map keyify-params target))
+ :else
+ target))
(defn wrap-keyword-params
"Middleware that converts the string-keyed :params map to one with keyword
View
4 ring-core/test/ring/middleware/keyword_params_test.clj
@@ -9,4 +9,6 @@
{"foo" "bar" "biz" "bat"}
{:foo "bar" :biz "bat"}
{"foo" "bar" "biz" [{"bat" "one"} {"bat" "two"}]}
- {:foo "bar" :biz [{:bat "one"} {:bat "two"}]}))
+ {:foo "bar" :biz [{:bat "one"} {:bat "two"}]}
+ {"foo" 1}
+ {:foo 1}))

0 comments on commit b64a520

Please sign in to comment.