clj-http-client/test/puppetlabs/http/client/test_common.clj
Preben Ingvaldsen fee17ad543 (TK-29) Use :query-params and change variable names
Use :query-params in the query param ring handler instead of
:params. Also change variable names used for testing.
2014-08-07 10:36:03 -07:00

25 lines
No EOL
722 B
Clojure

(ns puppetlabs.http.client.test-common
(:require [ring.middleware.params :as ring-params]
[puppetlabs.trapperkeeper.core :as tk]))
(defn query-params-test
[req]
{:status 200
:body (str (:query-params req))})
(def app-wrapped
(ring-params/wrap-params query-params-test))
(tk/defservice test-params-web-service
[[:WebserverService add-ring-handler]]
(init [this context]
(add-ring-handler app-wrapped "/params")
context))
(def queryparams {"foo" "bar"
"baz" "lux"})
(def query-options {:method :get
:url "http://localhost:8080/params/"
:query-params queryparams
:as :text})