aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-07 15:26:26 -0600
committerColin Okay <okay@toyful.space>2022-02-07 15:26:26 -0600
commit099f6509310bdbb2507a3ae6a119860885d99543 (patch)
treeef273785a567c0d41c6acd21f5dd5e799bc7f35d
parentb48bc4a09c1a44a2b1151ec5fa2452965a76ae95 (diff)
debugging post body deserialization
-rw-r--r--lazybones-hunchentoot.lisp7
-rw-r--r--lazybones.lisp4
-rw-r--r--package.lisp1
3 files changed, 9 insertions, 3 deletions
diff --git a/lazybones-hunchentoot.lisp b/lazybones-hunchentoot.lisp
index b87b83b..fd437e0 100644
--- a/lazybones-hunchentoot.lisp
+++ b/lazybones-hunchentoot.lisp
@@ -70,9 +70,10 @@ HEADER-NAME can be a keyword or a string."
'("multipart/form-data" "application/x-www-form-urlencoded"))
(defun pre-decoded-body-p (request)
- (member (request-header :content-type request)
- +hunchentoot-pre-decoded-content-types+
- :test #'string-equal))
+ (let ((header (request-header :content-type request)))
+ (when (stringp header)
+ (loop for prefix in +hunchentoot-pre-decoded-content-types+
+ thereis (a:starts-with-subseq prefix header)))))
(defparameter +hunchentoot-methods-with-body+
'(:post :put :patch))
diff --git a/lazybones.lisp b/lazybones.lisp
index 9b767bf..45da60b 100644
--- a/lazybones.lisp
+++ b/lazybones.lisp
@@ -301,6 +301,7 @@ making a new one if not."
,the-app
(make-instance
',endpoint-class
+ :method ,method
:route ,route
:pattern ',dispatch-pattern
:doc ,documentation
@@ -308,6 +309,9 @@ making a new one if not."
:function (lambda ,params ,@real-body)
,@endpoint-initargs))))))
+(defmacro defendpoint* (method route options &rest body)
+ "Like DEFENDPOINT but uses the current package name as the app name."
+ `(defendpoint ,(intern (package-name cl:*package*)) ,method ,route ,options ,@body))
;;; utilities
diff --git a/package.lisp b/package.lisp
index 515cf61..dabb38e 100644
--- a/package.lisp
+++ b/package.lisp
@@ -44,6 +44,7 @@
#:http-ok
#:http-err
#:defendpoint
+ #:defendpoint*
#:create-server
#:install-app
#:uninstall-app