pedestal

Daouda 2019-10-13T13:06:15.013Z

Hey Folks, I am facing an issue with pedestal routing in little project. My routing work fine with this:

(def routes
  #{["/"                 :get  (conj common-interceptors  `home-page)]
    ["/locals"           :post (conj common-interceptors  `upsert-local!)]
    ["/locals/:id"       :get  (conj common-interceptors  `find-one-local!)]})
But when I add one more route to the map, this get broken:
(def routes
  #{["/"                 :get  (conj common-interceptors  `home-page)]
    ["/locals"           :post (conj common-interceptors  `upsert-local!)]
    ["/locals/:id"       :get  (conj common-interceptors  `find-one-local!)]
    ["/locals"           :get  (conj common-interceptors  `find-map-local!)]})
Got this error:
INFO  io.pedestal.http  - {:msg "GET /", :line 80}
INFO  io.pedestal.http.cors  - {:msg "cors request processing", :origin "", :allowed true, :line 84}
ERROR i.p.http.impl.servlet-interceptor  - {:msg "Dev interceptor caught an exception; Forwarding it as the response.", :line 314}
clojure.lang.ExceptionInfo: clojure.lang.ExceptionInfo in Interceptor :io.pedestal.http.route/router - You're trying to use something as an interceptor that isn't supported by the protocol; Perhaps you need to extend it?
Here is the test I am running:
(fact "hitting home page endpoint"
  (GET "/" 200) => (match {:body {:msg "Hello World!"}}))

sova-soars-the-sora 2019-10-13T17:04:03.013800Z

You're using a SET #{} of vectors #{ [] [] [] [] } but in a SET every vector must be unique... is that the issue

sova-soars-the-sora 2019-10-13T17:04:21.014Z

actually it may just be the sequence.

sova-soars-the-sora 2019-10-13T17:04:33.014300Z

sometimes with COMPOJURE routing I have to adjust the order of things in the list.

sova-soars-the-sora 2019-10-13T17:04:38.014600Z

because it does matching sequentially

Daouda 2019-10-13T17:06:09.015300Z

Sorry but I still don’t get what I am doing wrong

Daouda 2019-10-13T17:06:56.016200Z

They are all unique to me, every vector in my set are different

2019-10-13T19:21:58.016700Z

What’s the definition of find-map-local! ?

2019-10-13T19:22:16.017200Z

Maybe you aren’t returning a proper interceptor?

sova-soars-the-sora 2019-10-13T19:23:25.017400Z

yeah find-map-local must be broken