   [app opts]
   (let [opts (merge default-options opts)]
     (State. app nil (:retries opts) false opts)))
+
+(declare retry-request)
 
 (defn- attempt-request
   [state downstream request current-state]

(ns picard.middleware.retry
  (:use [picard helpers utils]))

(defrecord State [app upstream retries sent-body? opts])

                (if (< 0 retry)
                  (timeout
                   (first (.retries current-state))
                   #(retry-request state downstream request current-state*))
                  (retry-request state downstream request current-state*)))))

           (when-let [current-downstream @current-downstream-atom]
             (current-downstream evt val))
