Fork me on GitHub
#pedestal
<
2016-11-17
>
tetriscodes21:11:17

(defn http-test-trigger [triggercomp context]
  (check-value triggercomp (:json-params context))
  (ring-resp/response {:response "success"}))

(defn- routes [triggercomp]
    #{["/api/triggers" :get
       (conj intercept/common-interceptors `http-get)]
      ["/api/triggers/:id" :get
       (conj intercept/common-interceptors `http-get-trigger)]
      ["/api/triggers/:id" :put
       (conj intercept/common-interceptors `http-put-trigger)]
      ["/api/triggers" :post
       (conj intercept/common-interceptors `http-post-trigger)]
      ["/api/triggers/:id" :delete
       (conj intercept/common-interceptors `http-delete-trigger)]
      ["/api/triggers/check" :post
       (conj intercept/common-interceptors `(partial http-test-trigger triggercomp))]})

tetriscodes21:11:43

Anyone know why I can’t put a partial as a route handler?

tetriscodes21:11:41

If I just use `http-test-trigger and remove the first component argument it works fine

ddeaguiar21:11:25

@tetriscodes You can use a partial but you need to specify a :route-name. I just did a quick test with a new pedestal app generated via lein

ddeaguiar21:11:46

hope that helps

ddeaguiar21:11:00

oh, looking more closely at the code you posted, you need wouldn't quote the partial. I think that's the problem in your example. That and the lack of a :route-name

ddeaguiar21:11:31

The other routes will use the name of the quoted fn by default

tetriscodes21:11:44

Its the lack of route name

tetriscodes21:11:56

two different errors

tetriscodes21:11:01

Thanks for the snippet

ddeaguiar21:11:20

Sure, you had to unquote as well, right?

ddeaguiar21:11:36

ok, makes sense.

ddeaguiar21:11:52

Glad to help 🙂