diff --git a/modules/reitit-core/src/reitit/impl.cljc b/modules/reitit-core/src/reitit/impl.cljc index 03c55e72..4bce736e 100644 --- a/modules/reitit-core/src/reitit/impl.cljc +++ b/modules/reitit-core/src/reitit/impl.cljc @@ -249,6 +249,10 @@ (->> params (map (fn [[k v]] (if (or (sequential? v) (set? v)) - (str/join "&" (map query-parameter (repeat k) v)) + (if (seq v) + (str/join "&" (map query-parameter (repeat k) v)) + ;; Empty seq results in single & character in the query string. + ;; Handle as empty string to behave similarly as when the value is nil. + (query-parameter k "")) (query-parameter k v)))) (str/join "&"))) diff --git a/test/cljc/reitit/impl_test.cljc b/test/cljc/reitit/impl_test.cljc index 526c140c..119a5fad 100644 --- a/test/cljc/reitit/impl_test.cljc +++ b/test/cljc/reitit/impl_test.cljc @@ -50,6 +50,8 @@ {"a" "b"} "a=b" {:a 1} "a=1" {:a nil} "a=" + {:a []} "a=" + {:a '()} "a=" {:a :b :c "d"} "a=b&c=d" {:a "b c"} "a=b+c" {:a ["b" "c"]} "a=b&a=c"