use a blank string for empty body instead of nil

otherwise the string "null" ends up used as the response body
This commit is contained in:
Gered 2015-02-14 20:14:22 -05:00
parent 4eab47cbdd
commit 096fd8fad5
2 changed files with 2 additions and 2 deletions

View file

@ -9,7 +9,7 @@
(def ^:private base-response (def ^:private base-response
{:status 200 {:status 200
:headers {} :headers {}
:body nil}) :body ""})
(defn content (defn content
"Returns a Ring response where the body is set to the value given." "Returns a Ring response where the body is set to the value given."

View file

@ -3,7 +3,7 @@
[clj-webtoolbox.response :as response])) [clj-webtoolbox.response :as response]))
(defn- ->response [body status] (defn- ->response [body status]
(-> (response/content body) (-> (response/content (if (nil? body) "" body))
(response/status status))) (response/status status)))
(defn ok [& [body]] (->response body 200)) (defn ok [& [body]] (->response body 200))