From 49f8cafff4b63ebb7c0fa3bfc182072d8d5197ea Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sun, 13 Feb 2022 19:38:51 -0600 Subject: Made 200 response the default. http-err now singals condition --- lazybones-hunchentoot.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lazybones-hunchentoot.lisp') 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 -- cgit v1.2.3