|
61 | 61 | (def ^:dynamic ^IPool *pool* nil)
|
62 | 62 | (def ^:dynamic *connection-options* nil)
|
63 | 63 | (def ^:dynamic ^String *response* nil)
|
64 |
| -(def ^:dynamic *use-tls?* false) |
| 64 | +(def ^:dynamic *use-tls-requests* false) |
65 | 65 |
|
66 | 66 |
|
67 | 67 | (def port 8082)
|
|
73 | 73 |
|
74 | 74 | (defn- make-url
|
75 | 75 | [path]
|
76 |
| - (if *use-tls?* |
| 76 | + (if *use-tls-requests* |
77 | 77 | (str "https://localhost:" port path)
|
78 | 78 | (str "http://localhost:" port path)))
|
79 | 79 |
|
|
170 | 170 | (if (zero? count)
|
171 | 171 | {:status 200 :body "ok"}
|
172 | 172 | {:status 302
|
173 |
| - :headers {"location" (str (if *use-tls?* "https://" "http://") |
| 173 | + :headers {"location" (str (if *use-tls-requests* "https://" "http://") |
174 | 174 | "localhost:" port
|
175 | 175 | "/redirect?count=" (dec count))}
|
176 | 176 | :body "redirected!"})))
|
|
256 | 256 | [handler server-options & body]
|
257 | 257 | ;; with-redefs used so clj fns running on netty threads will work
|
258 | 258 | `(testing "- http2"
|
259 |
| - (with-redefs [*use-tls?* true] |
| 259 | + (with-redefs [*use-tls-requests* true] |
260 | 260 | (with-server (http/start-server ~handler (merge http2-server-options ~server-options))
|
261 | 261 | ~@body))))
|
262 | 262 |
|
|
271 | 271 | (defmacro with-http-ssl-servers
|
272 | 272 | "Run the same body of tests for each HTTP version with SSL enabled"
|
273 | 273 | [handler server-options & body]
|
274 |
| - `(with-redefs [*use-tls?* true] |
| 274 | + `(with-redefs [*use-tls-requests* true] |
275 | 275 | (let [handler# ~handler
|
276 | 276 | server-options# ~server-options]
|
277 | 277 | (with-http2-server handler# server-options# ~@body)
|
|
457 | 457 | (let [ssl-session (atom nil)]
|
458 | 458 | (with-http-ssl-servers (ssl-session-capture-handler ssl-session) {}
|
459 | 459 | (reset! ssl-session nil)
|
460 |
| - (with-redefs [*use-tls?* false] ; will make http-get use http instead of https |
| 460 | + (with-redefs [*use-tls-requests* false] ; will make http-get use http instead of https |
461 | 461 | (is (some-> (http-get "/")
|
462 | 462 | (d/catch identity)
|
463 | 463 | deref
|
|
642 | 642 | (deftest test-explicit-url
|
643 | 643 | (with-handler hello-handler
|
644 | 644 | (is (= "hello" (-> @(http/request {:method :get
|
645 |
| - :scheme (if *use-tls?* :https :http) |
| 645 | + :scheme (if *use-tls-requests* :https :http) |
646 | 646 | :server-name "localhost"
|
647 | 647 | :server-port port
|
648 | 648 | :request-timeout 1e3
|
|
0 commit comments