Permalink
Browse files

keyword-params keeps keys that cannot be keywords (fixes #43)

  • Loading branch information...
1 parent 0c0e4a8 commit 48af80a6781ef359b12818962d66bcc21252c2d6 @weavejester weavejester committed Nov 27, 2011
View
7 ring-core/src/ring/middleware/keyword_params.clj
@@ -8,8 +8,11 @@
(cond
(map? target)
(into {}
- (for [[k v] target :when (keyword-syntax? k)]
- [(keyword k) (keyify-params v)]))
+ (for [[k v] target]
+ [(if (and (string? k) (keyword-syntax? k))
+ (keyword k)
+ k)
+ (keyify-params v)]))
(vector? target)
(vec (map keyify-params target))
:else
View
6 ring-core/test/ring/middleware/test/keyword_params.clj
@@ -13,4 +13,8 @@
{"foo" 1}
{:foo 1}
{"foo" 1 "1bar" 2 "baz*" 3 "quz-buz" 4 "biz.bang" 5}
- {:foo 1 :baz* 3 :quz-buz 4}))
+ {:foo 1 "1bar" 2 :baz* 3 :quz-buz 4 "biz.bang" 5}
+ {:foo "bar"}
+ {:foo "bar"}
+ {"foo" {:bar "baz"}}
+ {:foo {:bar "baz"}}))

0 comments on commit 48af80a

Please sign in to comment.