 (ns clj-http.core-test
-  (:use [clojure.test])
+  (:use [clojure.test]
+        [clojure.java.io :only [file]])
   (:require [clojure.pprint :as pp]
             [clj-http.core :as core]
             [clj-http.util :as util]
-            [ring.adapter.jetty :as ring]))
+            [ring.adapter.jetty :as ring])
+  (:import (java.io ByteArrayInputStream)))
 
 (defn handler [req]
-  (pp/pprint req)
-  (println) (println)
+  ;;(pp/pprint req)
+  ;;(println) (println)
   (condp = [(:request-method req) (:uri req)]
     [:get "/get"]
     {:status 200 :body "get"}

      (Thread/sleep 10)
      {:status 200 :body "timeout"})
    [:delete "/delete-with-body"]
    {:status 200 :body "delete-with-body"}))

(defn run-server
  []

        (is (= "get" (slurp-body resp))))
      (finally
       (.stop t)))))

(deftest ^{:integration true} multipart-form-uploads
  (run-server)
  (let [bytes (util/utf8-bytes "byte-test")
        stream (ByteArrayInputStream. bytes)
        resp (request {:request-method :post :uri "/multipart"
                       :multipart [["a" "testFINDMEtest"
                                    "b" bytes
                                    "c" (file "test-resources/keystore")
                                    "d" stream]]})
        resp-body (apply str (map char (:body resp)))]
    (is (= 200 (:status resp)))
    (is (re-find #"testFINDMEtest" resp-body))))
