Permalink
Browse files

Use clojure.core/slurp instead of slurp* from c.c.duck-streams or c.c…

….io.
  • Loading branch information...
1 parent 123eafe commit 0656880f9fb1ce619cc90a655fed5a2260c768dd @mmcgrana committed Oct 27, 2010
View
5 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,
@@ -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 {}})))
View
16 ring-core/test/ring/middleware/multipart_params_test.clj
@@ -1,20 +1,18 @@
(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))
-(defvar- upload-content-type
+(def ^:private upload-content-type
"multipart/form-data; boundary=----WebKitFormBoundaryAyGUY6aMxOI6UF5s")
-(defvar- upload-content-length 188)
+(def ^:private upload-content-length 188)
-(defvar- upload-body (tu/string-input-stream
+(def ^:private upload-body (tu/string-input-stream
"------WebKitFormBoundaryAyGUY6aMxOI6UF5s\r\nContent-Disposition: form-data; name=\"upload\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\n\r\nfoo\r\n\r\n------WebKitFormBoundaryAyGUY6aMxOI6UF5s--"))
-(defvar- wrapped-echo (wrap-multipart-params identity))
+(def ^:private wrapped-echo (wrap-multipart-params identity))
(deftest test-wrap-multipart-params
(let [req {:content-type upload-content-type
@@ -28,4 +26,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)))))))
View
7 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 ""}
@@ -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

0 comments on commit 0656880

Please sign in to comment.