                               socket-timeout
                               conn-request-timeout
                               max-redirects
-                              allow-circular-redirects
-                              allow-relative-redirects
-                              cookie-policy]}]
+                              cookie-policy]
+                       :as req}]
   (let [config (-> (RequestConfig/custom)
                    (.setConnectTimeout (or conn-timeout -1))
                    (.setSocketTimeout (or socket-timeout -1))

                     (failed [this ex]
                       (when-not (conn/reusable? conn-mgr)
                         (conn/shutdown-manager conn-mgr))
                       (if (:ignore-unknown-host? req)
                         ((:unknown-host-respond req) nil)
                         (raise ex)))
                     (completed [this resp]

                    (or conn-request-timeout -1))
                   (.setRedirectsEnabled true)
                   (.setCircularRedirectsAllowed
                    (boolean (opt req :allow-circular-redirects)))
                   (.setRelativeRedirectsAllowed
                    ((complement false?)
                     (opt req :allow-relative-redirects)))
                   (.setCookieSpec (get-cookie-policy cookie-policy)))]
    (when max-redirects (.setMaxRedirects config max-redirects))
    (.build config)))
