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:
parent
4eab47cbdd
commit
096fd8fad5
|
@ -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."
|
||||||
|
|
|
@ -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))
|
||||||
|
|
Reference in a new issue