Skip to content

Commit 0254c6e

Browse files
committed
Minor refactoring and cleanup
1 parent a2beb80 commit 0254c6e

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

test/aleph/http/clj_http/util.clj

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(:require
33
[aleph.http :as http]
44
[clj-commons.byte-streams :as bs]
5-
[clj-http.core :as core]
5+
[clj-http.core :as clj-http]
66
[clojure.set :as set]
77
[clojure.test :refer :all])
88
(:import
@@ -19,12 +19,12 @@
1919
:server-name "localhost"
2020
:server-port 18080})
2121

22-
(def uninteresting-headers ["date" "connection" "server"])
22+
(def ignored-headers ["date" "connection" "server"])
2323

2424
(defn header-keys
2525
"Returns a set of headers of interest"
2626
[m]
27-
(-> (apply dissoc m uninteresting-headers)
27+
(-> (apply dissoc m ignored-headers)
2828
(keys)
2929
(set)))
3030

@@ -72,18 +72,15 @@
7272
([req]
7373
(request req nil nil))
7474
([req respond raise]
75-
#_(core/request (merge base-req req) respond raise) ; no aleph
76-
7775
(if (or respond raise)
7876
;; do not attempt to compare when using async clj-http...for now
7977
(let [ring-map (merge base-req req)]
80-
(core/request ring-map respond raise))
78+
(clj-http/request ring-map respond raise))
8179

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)]
8784
(is (= (:status clj-http-resp) (:status aleph-resp)))
8885
(is-headers= (:headers clj-http-resp) (:headers aleph-resp))
8986
(let [new-clj-http-body (is-input-stream= (:body clj-http-resp) (:body aleph-resp))]

0 commit comments

Comments
 (0)