2014-08-06 17:49:48 +00:00
|
|
|
(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
|
2014-08-07 17:36:03 +00:00
|
|
|
:body (str (:query-params req))})
|
2014-08-06 17:49:48 +00:00
|
|
|
|
|
|
|
(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))
|
|
|
|
|
2014-08-07 17:36:03 +00:00
|
|
|
(def queryparams {"foo" "bar"
|
|
|
|
"baz" "lux"})
|
2014-08-06 21:23:56 +00:00
|
|
|
|
2014-08-06 21:33:26 +00:00
|
|
|
(def query-options {:method :get
|
|
|
|
:url "http://localhost:8080/params/"
|
2014-08-06 21:23:56 +00:00
|
|
|
:query-params queryparams
|
2014-08-06 21:33:26 +00:00
|
|
|
:as :text})
|