I'm using ring.mock.request to test an API. POST parameters work fine, but for GET requests, the parameters are not where Compojure expects to find them.
Here is the relevant part of the handler:
(GET "/outlines" [speaker :as r]
(println (str "Request " r))
(println (str "Param '" speaker "'"))
)
Here is the test using the mock request:
(let [req (request :get "/api/outlines" {:speaker "Test Speaker 1"})]
(is (= expected-outlines (api-routes req))))
Here is the value of the request and the 'speaker' parameter in the handler:
Request {:remote-addr "localhost", :scheme :http, :context "/api", :request-method :get, :query-string "speaker=Test+Speaker+1", :route-params {}, :path-info "/outlines", :uri "/api/outlines", :server-name "localhost", :params {}, :headers {"host" "localhost"}, :server-port 80}
Param ''
The mock library apparently puts the GET params into query-string, so Compojure does not see them. Is there a way to work around this without changing ring.mock.request?