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.lisp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'lazybones.lisp') diff --git a/lazybones.lisp b/lazybones.lisp index bab6ca2..fe2ebc3 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -18,6 +18,13 @@ "Dynamic variable holding the an APP instance. Dynamically bound by RUN-ENDPOINT so that it is available if needed in request handlers.") +;;; HTTP-ERROR CONDITION + +(define-condition http-error (condition) + ((code :initarg :code) + (content :initarg :content))) + + ;;; APP NAMESPACE (lisp-namespace:define-namespace lazybones) @@ -365,21 +372,10 @@ making a new one if not." "Like DEFENDPOINT but uses the current package name as the app name." `(defendpoint ,(default-app-name) ,method ,route ,params ,options ,@body)) - - - ;;; ENDPOINT HANDLING UTILITIES - -(defun http-ok (content) - "Content should be a string, a byte-vector, or a pathname to a local -file. CONTENT-TYPE should be a MIME type string." - (http-respond 200 content)) - (defun http-err (code &optional content) - "*APP*, *RESPONSE* and *REQUEST* should all be defined here." - (http-respond - code - content)) + "Singals an HTTP-ERROR with code and content." + (signal 'http-error :content content :code code)) -- cgit v1.2.3