clojureliberator

How to mock request a parameterised resource in liberator?


How can I mock a request to a parameterised liberator resource? Here's my code:

(defresource lookup [id]
  :available-media-types  ["application/json"]
  :allowed-methods        [:get]
  :handle-ok              #(lookup-event id))

(event/lookup (ring.mock.request/request :get "/event/1" ))

I just get a function back instead of response. Could you tell me what I'm doing wrong here?


Solution

  • Turns out this is the correct way to do it.

    ((event/lookup 1) (ring.mock.request/request :get "/event/1" ))