 ;; default set of callbacks
 
 ;; status callbacks
-(defn accept-ok [_ status]
-  (if (not (= (:code status) 200)) :abort))
-
-(defn status-collect [state status]
-  "Stores status map under :status in state."
-  (dosync (alter state assoc :status status)))
-
-(defn status-print [state st]
-  (println (str (:id @state) "< " (:protocol st) " " (:code st) " " (:msg st))))
-
-(defn new-status-collect [_ status]
+(defn status-collect [_ status]
   "Returns all status and procides with execution"
   [status :continue])
 
 ;; header callbacks
-(defn headers-collect [state headers]
-  "Stores headers under :headers in state."
-  (if headers
-    (dosync (alter state assoc :headers headers))
-    (do
-      (println "Received empty headers, aborting.")
-      :abort)))
-
-(defn print-headers [state headers]
-  (doall (map #(println (str (:id @state) "< " % ": " (get headers %))) (keys headers))))
-
-(defn new-headers-collect [_ headers]
+(defn headers-collect [_ headers]
   "Reurns all headers, or aborts if no headers provided."
   [headers (if-not headers :abort)])
 
 ;; body callbacks
 (defn body-collect [state baos]
-  "Stores body parts under :body in state."
-  (if (:body @state)
-    (.writeTo baos (:body @state))
-    (dosync (alter state assoc :body baos))))
-
-(defn new-body-collect [state baos]
   (let [body (:body state)]
     (if (delivered? body)
       (do


;; completed callbacks
(defn body-completed [state]
  "Provides value that will be delivered to response promise."
  @state)

(defn new-body-completed [state]
  [true :continue])

;; error callbacks
(defn error-collect [state t]
  "Stores exception under :error in state"
  (dosync (alter state assoc :error t)))

(defn new-error-collect [state t]
  [t :continue])

;; default set of callbacks
(def *default-callbacks*
     {:status new-status-collect
      :headers new-headers-collect
      :part new-body-collect
      :completed new-body-completed
      :error new-error-collect})

(defn url-encode
  "Taken from Clojure Http Client"

       (onThrowable [#^Throwable t]
                    (do
                      (print-cause-trace t)
                      (deliver (:error resp) (error resp t))
                      (deliver (:done resp) true)))))
    ^{:started (System/currentTimeMillis)}
    resp))
