ring-clojure / ring-json

Ring middleware for handling JSON
313 stars 47 forks source link

Add CPS support #46

Closed bobotu closed 7 years ago

bobotu commented 8 years ago

Add CPS support to json-middleware

weavejester commented 8 years ago

Can you add -request and -response functions where it makes sense to do so, like the rest of the Ring async code? For example:

(defn json-body-request
  "Parse a JSON request body and assoc it back into the :body key. Returns nil
  if the JSON is malformed. See: wrap-json-body."
  [request options]
  (if-let [[valid? json] (read-json request options)]
    (if valid? (assoc request :body json))
    request))
bobotu commented 8 years ago

@weavejester I have modified the code, is this okay?

weavejester commented 8 years ago

I've added some comments to your code. I think there are a couple of lines that have an error/typo, and the functions you've doc-stringed should be public now :)

bobotu commented 8 years ago

@weavejester Thanks for your patient. I have fixed those mistakes just now.