Skip to content

Commit 02f724b

Browse files
committed
Add additional tests for form-decode corner cases
1 parent b25f8cc commit 02f724b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

test/ring/util/test/codec.clj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@
6565
"a=b%2Fc" {"a" "b/c"}
6666
"a=b&c" {"a" "b" "c" ""}
6767
"a=&b=c" {"a" "" "b" "c"}
68-
"a&b=c" {"a" "" "b" "c"})
68+
"a&b=c" {"a" "" "b" "c"}
69+
"=" {"" ""}
70+
"a=" {"a" ""}
71+
"=b" {"" "b"})
72+
(testing "invalid URL encoding"
73+
(are [x y] (= (form-decode x) y)
74+
"%=b" {nil "b"}
75+
"a=%" {"a" nil}
76+
"%=%" {nil nil}))
6977
(is (= (form-decode "a=foo%FE%FF%00%2Fbar" "UTF-16")
7078
{"a" "foo/bar"})))

0 commit comments

Comments
 (0)