Permalink
Browse files

Removed ring.middleware.static middleware

  • Loading branch information...
1 parent 0476c7a commit b6aaae1fd22b629184ea3dca02d7d5af2f71020d @weavejester weavejester committed Oct 2, 2011
Showing with 0 additions and 38 deletions.
  1. +0 −1 README.md
  2. +0 −18 ring-core/src/ring/middleware/static.clj
  3. +0 −19 ring-core/test/ring/middleware/test/static.clj
View
@@ -59,7 +59,6 @@ To see a more sophisticated Ring app, run:
* `ring.middleware.file`: Serve static files out of a public directory.
* `ring.middleware.resource`: Serve static classpath resources.
-* `ring.middleware.static`: Serve static files with specified prefixes out of a public directory.
* `ring.middleware.file-info`: Augment response headers with info about File responses.
* `ring.middleware.content-type`: Augment response headers with a content-type based on the file extension.
* `ring.middleware.params`: Parse query and form params.
@@ -1,18 +0,0 @@
-(ns ring.middleware.static
- "Static file serving, more selective than ring.middleware.file."
- (:use ring.middleware.file))
-
-(defn wrap-static
- "Like ring.file, but takes an additional statics, a coll of Strings that will
- be used to test incoming requests uris. If a uri begins with any of the
- strings in the statics coll, the middleware will check to see if a file can be
- served from the public-dir before proxying back to the given app; if the uri
- does not correspond to one of these strings, the middleware proxies the
- request directly back to the app without touching the filesystem."
- [app public-dir statics]
- (let [app-with-file (wrap-file app public-dir)]
- (fn [req]
- (let [^String uri (:uri req)]
- (if (some #(.startsWith uri %) statics)
- (app-with-file req)
- (app req))))))
@@ -1,19 +0,0 @@
-(ns ring.middleware.test.static
- (:use clojure.test
- ring.middleware.static)
- (:import java.io.File))
-
-(def public-dir "test/ring/assets")
-(def foo-html "test/ring/assets/foo.html")
-(def nested-foo-html "test/ring/assets/bars/foo.html")
-(def statics ["/foo.html" "/bars/"])
-
-(def app (wrap-static (constantly {:body :dynamic}) public-dir statics))
-
-(defn app-response-body [uri]
- (:body (app {:request-method :get :uri uri})))
-
-(deftest test-wrap-static-smoke
- (is (= (File. foo-html) (app-response-body "/foo.html")))
- (is (= (File. nested-foo-html) (app-response-body "/bars/foo.html")))
- (is (= :dynamic (app-response-body "/not/static"))))

0 comments on commit b6aaae1

Please sign in to comment.