Skip to content

Commit

Permalink
Use clojure.core/slurp instead of slurp* from c.c.duck-streams or c.c…
Browse files Browse the repository at this point in the history
….io.
  • Loading branch information
mmcgrana committed Nov 1, 2010
1 parent d778ce4 commit b97bd12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions ring-core/src/ring/middleware/params.clj
@@ -1,8 +1,7 @@
(ns ring.middleware.params
"Parse form and query params."
(:require [ring.util.codec :as codec]
[clojure.string :as string]
[clojure.contrib.io :as io]))
[clojure.string :as string]))

(defn assoc-param
"Associate a key with a value. If the key already exists in the map,
Expand Down Expand Up @@ -48,7 +47,7 @@
[request encoding]
(merge-with merge request
(if-let [body (and (urlencoded-form? request) (:body request))]
(let [params (parse-params (io/slurp* body) encoding)]
(let [params (parse-params (slurp body) encoding)]
{:form-params params, :params params})
{:form-params {}, :params {}})))

Expand Down
8 changes: 3 additions & 5 deletions ring-core/test/ring/middleware/multipart_params_test.clj
@@ -1,9 +1,7 @@
(ns ring.middleware.multipart-params-test
(:use clojure.test
ring.middleware.multipart-params
[clojure.contrib.def :only (defvar-)])
(:require [clojure.contrib.duck-streams :as du]
[ring.util.test :as tu])
ring.middleware.multipart-params)
(:require [ring.util.test :as tu])
(:import java.io.File))

(def ^{:private true}
Expand Down Expand Up @@ -35,4 +33,4 @@
(is (= 5 (:size upload)))
(is (= "text/plain" (:content-type upload)))
(is (instance? File (:tempfile upload)))
(is (= "foo\r\n" (du/slurp* (:tempfile upload)))))))
(is (= "foo\r\n" (slurp (:tempfile upload)))))))
7 changes: 3 additions & 4 deletions ring-core/test/ring/util/response_test.clj
@@ -1,7 +1,6 @@
(ns ring.util.response-test
(:use clojure.test
ring.util.response
[clojure.contrib.duck-streams :only (slurp*)]))
ring.util.response))

(deftest test-redirect
(is (= {:status 302 :headers {"Location" "http://google.com"} :body ""}
Expand All @@ -22,12 +21,12 @@
(let [resp (resource-response "/ring/util/response_test.clj")]
(is (= (resp :status) 200))
(is (= (resp :headers) {}))
(is (.startsWith (slurp* (resp :body))
(is (.startsWith (slurp (resp :body))
"(ns ring.util.response-test"))))

(deftest test-resource-with-root
(let [resp (resource-response "response_test.clj" {:root "/ring/util"})]
(is (.startsWith (slurp* (resp :body))
(is (.startsWith (slurp (resp :body))
"(ns ring.util.response-test"))))

(deftest test-missing-resource
Expand Down

0 comments on commit b97bd12

Please sign in to comment.