ataraxy
ataraxy copied to clipboard
Routes should match when destructured value is false
I think these cases should match with not nil value?
(def routes '{#{x} [:foo x]})
(matches routes {:uri "/" :query-params {"x" false}})
;;=> [:ataraxy.error/missing-params #{x}]
(def routes '{{{:keys [q]} :body-params} [:foo q]})
(matches routes {:uri "/" :body-params {:q false}})
;;=> [:ataraxy.error/missing-destruct #{q}]
This behaviour should be fine for query parameters, since they're always a map of strings to strings.
However, you're right that destructuring the request might throw up a false value, and ideally that should be treated differently to nil. The checks should probably use some? instead of just looking for falsey values.