Skip to content

Commit 2941cd9

Browse files
authored
Merge pull request #18 from boechat107/17-extending-formencodeable-nil
Extend FormEncodeable to nil values
2 parents 94a4647 + aa03f40 commit 2941cd9

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/ring/util/codec.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@
9898
(str/join "&"))))
9999
Object
100100
(form-encode* [x encoding]
101-
(form-encode* (str x) encoding)))
101+
(form-encode* (str x) encoding))
102+
nil
103+
(form-encode* [x encoding] ""))
102104

103105
(defn form-encode
104106
"Encode the supplied value into www-form-urlencoded format, often used in

test/ring/util/test/codec.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
{"a" "b"} "a=b"
4343
{:a "b"} "a=b"
4444
{"a" 1} "a=1"
45+
{"a" nil} "a="
4546
{"a" "b" "c" "d"} "a=b&c=d"
4647
{"a" "b c"} "a=b+c")
4748
(is (= (form-encode {"a" "foo/bar"} "UTF-16") "a=foo%FE%FF%00%2Fbar"))))

0 commit comments

Comments
 (0)