We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bffc392 commit e365932Copy full SHA for e365932
2 files changed
src/compojure/http/request.clj
@@ -22,10 +22,11 @@
22
[param-string separator]
23
(reduce
24
(fn [param-map s]
25
- (let [[key val] (re-split #"=" s)]
+ (if-let [[_ key val] (re-matches #"([^=]+)=(.*)" s)]
26
(assoc-vec param-map
27
(keyword (urldecode key))
28
- (urldecode (or val "")))))
+ (urldecode (or val "")))
29
+ param-map))
30
{}
31
(remove blank?
32
(re-split separator param-string))))
test/compojure/http/request.clj
@@ -16,6 +16,13 @@
16
(is (= (parse-query-params {:query-string "a=1%202"})
17
{:a "1 2"})))
18
19
+(deftest query-params-invalid
20
+ (are (= (parse-query-params {:query-string _1}) _2)
21
+ "" {}
+ "=" {}
+ "=1" {}
+ "a=1&=" {:a "1"}))
+
(deftest urlencoded-charset
(is (urlencoded-form?
{:content-type "application/x-www-form-urlencoded; charset=UTF8"})))
0 commit comments