(defvar res nil)
(setf res (make-response 200))
(setf res (make-response 200 '(:content-type "text/html")))
(setf res (make-response 200 '(:content-type "text/html") '("aiueo")))
;; Access each fields
(status res)
;;=> 200
(headers res)
;;=> (:content-type "text/html")
(headers res :content-type)
;;=> "text/html"
(body res)
;;=> ("aiueo")
;; Set to each fields
(setf (status res) 304)
(setf (headers res :content-type) "text/plain")
(setf (body res) '("moved"))
(setf (body res) "moved") ;; string also allowed Clack.Response allows you a way to create Clack response.
Portable HTTP Response object for Clack response.
A synonym for (make-instance '...). Create a instance.
Get all included headers, or the header value that corresponds to `name`. Example: (headers res) ;;=> (:content-type "text/plain") (headers res :content-type) ;;=> "text/plain"
Set headers. Example: (setf (headers res) '(:content-type "text/html")) (setf (headers res :content-type) "text/html")
Push the given header pair into response headers. Example: (push-header res :content-type "text/html")
Set body with normalizing. body must be a list.
Get whole of set-cookies plist or the set-cookie value of given name. Example: (set-cookies res) ;;=> (:hoge "1") (set-cookies res :hoge) ;;=> "1"
Set set-cookies. Example: (setf (set-cookies res) '(:hoge "1")) (setf (set-cookies res :hoge) "1")
Set headers for redirecting to given url.
Return a Clack response list containing three values: status, headers, and body.