clj-http-server-template/resources/clj/new/http_server_template/response.clj

23 lines
415 B
Clojure

(ns {{namespace}}.response)
(defn- to-status
[status]
(case status
:ok 200
:not-found 404
:internal-error 500
500))
(defn- to-content-type
[content-type]
(case content-type
:html "text/html"
:plain "text/plain"
"text/plain"))
(defn response
[status content-type body]
{:status (to-status status)
:headers {"Content-Type" (to-content-type content-type)}
:body body})