liberator

2017-03-30T22:02:42.562117Z

hello, how do you test a defresource with parameters? Here's the scenario:

;; core.clj:
(defresource parameter [txt]
  :available-media-types ["text/plain"]
  :handle-ok (fn [_] (format "The text is %s" txt)))

;; core_test.clj:
(facts "about :get parameter [txt]"
    (let [response (parameter {:request-method :get :params {:txt "hello-world"}})]
        (fact "body: The text is hello-world" response => "The text is hello-world")))
The ... :params {:txt "hello-world"} is superficial, since I'm not sure how to test a defresource with parameters I simply get parameter/fn--\n* if I inspect the response 😞