From 099f6509310bdbb2507a3ae6a119860885d99543 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 7 Feb 2022 15:26:26 -0600 Subject: debugging post body deserialization --- lazybones-hunchentoot.lisp | 7 ++++--- lazybones.lisp | 4 ++++ package.lisp | 1 + 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 -- cgit v1.2.3