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.lisp | |
parent | 74eda585255b4a4d26cc783cecf2312a71370ed3 (diff) |
Made 200 response the default. http-err now singals condition
Diffstat (limited to 'lazybones.lisp')
-rw-r--r-- | lazybones.lisp | 22 |
1 files changed, 9 insertions, 13 deletions
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)) |