Fork me on GitHub
#pedestal
<
2019-10-13
>
Daouda13:10:15

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-sora17:10:03

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

sova-soars-the-sora17:10:21

actually it may just be the sequence.

sova-soars-the-sora17:10:33

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

sova-soars-the-sora17:10:38

because it does matching sequentially

Daouda17:10:09

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

Daouda17:10:56

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

dadair19:10:58

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

dadair19:10:16

Maybe you aren’t returning a proper interceptor?

sova-soars-the-sora19:10:25

yeah find-map-local must be broken