|
2 | 2 | (:require
|
3 | 3 | [aleph.http :as http]
|
4 | 4 | [clj-commons.byte-streams :as bs]
|
5 |
| - [clj-http.core :as core] |
| 5 | + [clj-http.core :as clj-http] |
6 | 6 | [clojure.set :as set]
|
7 | 7 | [clojure.test :refer :all])
|
8 | 8 | (:import
|
|
19 | 19 | :server-name "localhost"
|
20 | 20 | :server-port 18080})
|
21 | 21 |
|
22 |
| -(def uninteresting-headers ["date" "connection" "server"]) |
| 22 | +(def ignored-headers ["date" "connection" "server"]) |
23 | 23 |
|
24 | 24 | (defn header-keys
|
25 | 25 | "Returns a set of headers of interest"
|
26 | 26 | [m]
|
27 |
| - (-> (apply dissoc m uninteresting-headers) |
| 27 | + (-> (apply dissoc m ignored-headers) |
28 | 28 | (keys)
|
29 | 29 | (set)))
|
30 | 30 |
|
|
72 | 72 | ([req]
|
73 | 73 | (request req nil nil))
|
74 | 74 | ([req respond raise]
|
75 |
| - #_(core/request (merge base-req req) respond raise) ; no aleph |
76 |
| - |
77 | 75 | (if (or respond raise)
|
78 | 76 | ;; do not attempt to compare when using async clj-http...for now
|
79 | 77 | (let [ring-map (merge base-req req)]
|
80 |
| - (core/request ring-map respond raise)) |
| 78 | + (clj-http/request ring-map respond raise)) |
81 | 79 |
|
82 |
| - (let [ring-map (merge base-req req) |
83 |
| - ;;_ (clojure.pprint/pprint ring-map) |
84 |
| - clj-http-resp (core/request ring-map) |
85 |
| - ;;_ (clojure.pprint/pprint ring-map) |
86 |
| - aleph-resp @(http/request (assoc ring-map :pool no-middleware-pool))] |
| 80 | + (let [clj-http-ring-map (merge base-req req) |
| 81 | + aleph-ring-map (merge base-req req {:pool no-middleware-pool}) |
| 82 | + clj-http-resp (clj-http/request clj-http-ring-map) |
| 83 | + aleph-resp @(http/request aleph-ring-map)] |
87 | 84 | (is (= (:status clj-http-resp) (:status aleph-resp)))
|
88 | 85 | (is-headers= (:headers clj-http-resp) (:headers aleph-resp))
|
89 | 86 | (let [new-clj-http-body (is-input-stream= (:body clj-http-resp) (:body aleph-resp))]
|
|
0 commit comments