domkm / silk

Routing for Clojure & ClojureScript
222 stars 13 forks source link

`match-coll` not working as expected #27

Open volrath opened 8 years ago

volrath commented 8 years ago

I know the title is broad and unspecific.

I tried this snippet from the README and it doesn't work:

Routes can be constrained by request methods.

(def api-routes
  (silk/routes {:api-data [["api"] {"limit" (silk/? (silk/int :limit) {:limit 100})
                                    "offset" (silk/? (silk/int :offset) {:offset 0})} (serve/POST)]}))

(silk/match api-routes {:path ["api"]})
;=> nil
(silk/match api-routes {:path ["api"] :request-method :post})
;=> {:limit 100, :offset 0, :domkm.silk/name :api-data, ...}

Last silk/match call also returned nil.

I debugged the error for a while, and narrowed it down to match-coll, but I'm not sure exactly what could be happening there.

I'm posting this here so we can discuss way to fix it, and I'll be happy to submit a PR if some guidance is provided.