Permalink
Browse files

Remove contrib dependencies form r.m.multipart params.

  • Loading branch information...
1 parent 821c675 commit d778ce41a746594658f487e72101b8fcf0960431 @mmcgrana committed Oct 26, 2010
View
11 ring-core/src/ring/middleware/multipart_params.clj
@@ -1,7 +1,6 @@
(ns ring.middleware.multipart-params
"Parse multipart upload into params."
- (:use [clojure.contrib.def :only (defvar-)]
- [ring.middleware.params :only (assoc-param)])
+ (:use [ring.middleware.params :only (assoc-param)])
(:import (org.apache.commons.fileupload
FileUpload RequestContext)
(org.apache.commons.fileupload.disk
@@ -14,12 +13,14 @@
(if-let [^String content-type (:content-type request)]
(.startsWith content-type "multipart/form-data")))
-(defvar- ^FileUpload file-upload
+(def ^{:private true
+ :type FileUpload
+ :doc "Uploader class to save multipart form values to temporary files."}
+ file-upload
(FileUpload.
(doto (DiskFileItemFactory.)
(.setSizeThreshold -1)
- (.setFileCleaningTracker nil)))
- "Uploader class to save multipart form values to temporary files.")
+ (.setFileCleaningTracker nil))))
(defn- request-context
"Create a RequestContext object from a request map."
View
17 ring-core/test/ring/middleware/multipart_params_test.clj
@@ -6,15 +6,22 @@
[ring.util.test :as tu])
(:import java.io.File))
-(defvar- upload-content-type
+(def ^{:private true}
+ upload-content-type
"multipart/form-data; boundary=----WebKitFormBoundaryAyGUY6aMxOI6UF5s")
-(defvar- upload-content-length 188)
+(def ^{:private true}
+ upload-content-length
+ 188)
-(defvar- 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--"))
+(def ^{:private true}
+ 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 true}
+ wrapped-echo
+ (wrap-multipart-params identity))
(deftest test-wrap-multipart-params
(let [req {:content-type upload-content-type

0 comments on commit d778ce4

Please sign in to comment.