 
 (fact "Wrapped handler with request whose body is JSON"
   (wrapped-handler-of-interesting-request
-   {:headers {"content-type" "application/json; charset=utf-8"}
-    :body (string->stream "{\"user\":\"Fred\"}")})
+   (make-my-request))
   => {:status 200
       :headers {}
       :body "Uploaded 'Fred'."})

(defn identity-handler [request]
  request)

(def my-request
  {:headers {"content-type" "application/json; charset=utf-8"}
   :query-string "q1=a&q2=b"
   :body (string->stream "{\"user\":\"Fred\"}")})

;;;; ___________________________________________________________________________
;;;; ---- rmp/wrap-params ----

(let [req (make-my-request)]
  (fact ((-> identity-handler
             rmp/wrap-params)
         req)
    => (just (merge req
                    {:body         anything
                     :form-params  {}
                     :params       {"q1" "a"
                                    "q2" "b"}
                     :query-params {"q1" "a"
                                    "q2" "b"}}))))

;;;; ___________________________________________________________________________
;;;; ---- rmj/wrap-json-params ----

(let [req (make-my-request)]
  (fact ((-> identity-handler
             rmj/wrap-json-params)
         req)
    => (just (merge req
                    {:body        anything
                     :json-params {"user" "Fred"}
                     :params      {"user" "Fred"}}))))

;;;; ___________________________________________________________________________

