File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 134134 " Activate clj-http-hystrix to wrap all clj-http client requests as
135135 hystrix commands."
136136 []
137- (when-not (some-> (meta http/request) :robert.hooke/hooks deref (contains? #'wrap-hystrix))
138- (hooke/add-hook #'http/request #'wrap-hystrix)))
137+ (hooke/add-hook #'http/request #'wrap-hystrix))
Original file line number Diff line number Diff line change 44 [clj-http.client :as http]
55 [clojure.java.io :refer [resource]]
66 [clojure.tools.logging :refer [warn error]]
7+ [robert.hooke :as hooke]
78 [rest-cljer.core :refer [rest-driven]]
89 [midje.sweet :refer :all ])
910 (:import [java.net SocketTimeoutException]
171172 (predicate {} {:status 101 }) => false
172173 (predicate {} {:status 202 }) => false
173174 (predicate {} {:status 299 }) => false ))
175+
176+ (defn get-hooks []
177+ (some-> http/request meta :robert.hooke/hooks deref))
178+
179+ (fact " add-hook can be safely called more than once"
180+ (count (get-hooks )) => 1
181+ (get (get-hooks ) #'wrap-hystrix) => #'wrap-hystrix
182+ ; call add-hook a few more times and ensure only one hook is present
183+ (add-hook ), (add-hook ), (add-hook )
184+ (count (get-hooks )) => 1
185+ (get (get-hooks ) #'wrap-hystrix) => #'wrap-hystrix)
You can’t perform that action at this time.
0 commit comments