ataraxy icon indicating copy to clipboard operation
ataraxy copied to clipboard

Routes should match when destructured value is false

Open quan-nh opened this issue 8 years ago • 1 comments

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}]

quan-nh avatar Jul 02 '17 08:07 quan-nh

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.

weavejester avatar Jul 02 '17 15:07 weavejester