Permalink
Browse files

Update SPEC to reflect dropped requirement of namespacing non-standar…

…d keys. Update ring.middleware.lint accordingly.
  • Loading branch information...
1 parent bbbb79a commit 8f234d24510fe0d0ae862a7761ab86b8fdad827a @mmcgrana committed Mar 8, 2010
Showing with 3 additions and 27 deletions.
  1. +1 −8 SPEC
  2. +2 −19 ring-devel/src/ring/middleware/lint.clj
View
9 SPEC
@@ -1,4 +1,4 @@
-=== Ring Spec (0.1)
+=== Ring Spec (0.2)
Ring is defined in terms of handlers, middleware, adapters, requests maps, and
response maps, each of which are described below.
@@ -85,10 +85,6 @@ corresponding values:
(Optional, InputStream)
An InputStream for the request body, if present.
-If a component invokes another component with a request map containing
-additional keys, these keys must be namespaced using the Clojure
-:name.space/key-name convention. The ring.* namespaces are reserved.
-
== Response Map
A response map is a Clojure map containing at least the following keys and corresponding values:
@@ -118,6 +114,3 @@ A response map is a Clojure map containing at least the following keys and corre
InputStream:
Contents are consumed from the stream and sent to the client. When the
stream is exhausted, it is .close'd.
-
-As with request maps, keys in response maps other than those listed above should
-be appropriately namespaced.
View
21 ring-devel/src/ring/middleware/lint.clj
@@ -19,15 +19,6 @@
message (pr-str val) (.getMessage e))
(throw e)))))
-(defn- lint-namespacing
- "Asserts that all keys are namespaces other than those included in a
- specified set of permitted unnamspaced keys"
- [map map-name no-namespace-needed]
- (let [must-namespace (set/difference (set (keys map)) no-namespace-needed)]
- (doseq [k must-namespace]
- (lint k namespace
- (format "user keys in the %s map must be namespaced" map-name)))))
-
(defn- check-req
"Validates the request, throwing an exception on violations of the spec"
[req]
@@ -67,12 +58,7 @@
"header values must be strings")))
(lint (:body req) #(or (nil? %) (instance? InputStream %))
- ":body must be nil or an InputStream")
-
- (lint-namespacing req "request"
- #{:server-port :server-name :remote-addr :uri :query-string :scheme
- :request-method :content-type :content-length :character-encoding
- :headers :body}))
+ ":body must be nil or an InputStream"))
(defn- check-resp
"Validates the response, throwing an exception on violations of the spec"
@@ -94,10 +80,7 @@
(lint (:body resp) #(or (nil? %) (string? %) (instance? File %)
(instance? InputStream %))
- ":body must a String, File, or InputStream")
-
- (lint-namespacing resp "response"
- #{:status :headers :body}))
+ ":body must a String, File, or InputStream"))
(defn wrap-lint
"Wrap an app to validate incoming requests and outgoing responses

0 comments on commit 8f234d2

Please sign in to comment.