 
 (defn response-not-found
   [id]
-  (-> (str id " not found")
-      (map-response 404 id)))
+  (map-response (str id " not found") 404 id))
 
 
 (defn response-error

  "Provides an ExceptionInfo exception when the input is not valid. This is a
   400 status response. If the message is not provided, a generic one is used."
  [& [msg]]
  (-> (or msg "invalid request")
      (ex-response 400)))


(defn ex-not-found
  "Provides an ExceptionInfo exception when a resource is not found. This is a
   404 status response and the provided id should be the resource identifier."
  [id]
  (-> (str id " not found")
      (ex-response 404 id)))


(defn ex-conflict
  "Provides an ExceptionInfo exception when there is a conflict. This is a 409
   status response and the provided id should be the resource identifier."
  [id]
  (-> (str "conflict with " id)
      (ex-response 409 id)))


(defn ex-unauthorized

   used. This is a 404 status code. Information from the request and the action
   are used to provide a reasonable message."
  [{:keys [uri request-method] :as request} action]
  (let [msg (format "undefined action (%s, %s) for %s"
                    (name (or request-method "UNKNOWN"))
                    action
                    (or uri "UNKNOWN"))]
    (ex-response msg 404 uri)))


(defn ex-bad-CIMI-filter
