diff options
author | Colin Okay <okay@toyful.space> | 2022-02-13 19:38:51 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-02-13 19:38:51 -0600 |
commit | 49f8cafff4b63ebb7c0fa3bfc182072d8d5197ea (patch) | |
tree | 69f071f9bffad05bf3f8cea8098d424a4d70fedc /lazybones-hunchentoot.lisp | |
parent | 74eda585255b4a4d26cc783cecf2312a71370ed3 (diff) |
Made 200 response the default. http-err now singals condition
Diffstat (limited to 'lazybones-hunchentoot.lisp')
-rw-r--r-- | lazybones-hunchentoot.lisp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lazybones-hunchentoot.lisp b/lazybones-hunchentoot.lisp index b010052..c5e55fa 100644 --- a/lazybones-hunchentoot.lisp +++ b/lazybones-hunchentoot.lisp @@ -39,11 +39,16 @@ finally (let ((lzb:*request* request) (lzb:*response* h:*reply*)) (return (lzb:http-err 404)))) + (lzb::http-error (http-error) + (let ((lzb:*request* request) + (lzb:*response* h:*reply*)) + (with-slots (lzb::code lzb::content) http-error + (http-respond lzb::content lzb::code)))) (error (e) (declare (ignorable e)) (let ((lzb:*request* request) (lzb:*response* h:*reply*)) - (lzb:http-err 500))))) + (http-respond 500))))) ;;; SERVER FUNCTIONS @@ -220,7 +225,7 @@ the value of the Content-Type request header." (cadar (setf (h:cookies-out response) (cons (cons name value) (h:cookies-out response)))))) -(defun http-respond (code content) +(defun http-respond (content &optional (code 200)) "Final step preparing response before backend does the rest. For Hunchentoot, set the response code and a few headers. If content is a pathname, pass off to HUNCHENTOOT:HANDLE-STATIC-FILE, otherwise just |