aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-05-12 20:35:56 -0700
committercolin <colin@cicadas.surf>2024-05-12 20:35:56 -0700
commit31b4519eceac7d12ca22fa5bf2e96035ee6003d0 (patch)
treede1fdda20e8d81cdac3810c9a7d9271db0c21aaa
parentaa6f3256614a2b97cc8c46a84ad2de46add8a8b0 (diff)
Fix: route builder bug;
-rw-r--r--src/endpoint.lisp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/endpoint.lisp b/src/endpoint.lisp
index 4f44a41..223c24a 100644
--- a/src/endpoint.lisp
+++ b/src/endpoint.lisp
@@ -163,12 +163,15 @@ the request's POST-PARAMETERS slot."
(defvar *mimetype-parsers*
(make-hash-table :test #'equal))
-(defun lookup-body-parser (type &key errorp)
- (multiple-value-bind (parser extant) (gethash type *mimetype-parsers*)
- (when errorp
- (unless extant
- (error "Body parser not found for mimethype ~s~%Try registering a parser with (REGISTER-BODY-PARSER ~s <yourparser>)" type type)))
- parser))
+(defun lookup-body-parser (typestring &key errorp)
+ (let ((type (first (serapeum:split-sequence #\; typestring))))
+ (multiple-value-bind (parser extant) (gethash type *mimetype-parsers*)
+ (when errorp
+ (unless extant
+ (error "Body parser not found for mimetype ~s
+Try registering a parser with (REGISTER-BODY-PARSER ~s <yourparser>)"
+ type type)))
+ parser)))
(defun register-body-parser (type function)
"TYPE should be a string naming a mimetype. FUNCTION should be a
@@ -209,7 +212,7 @@ matching regex."
:with extractors := (copy-seq (route-extractors class))
:for part :in (ppcre:parse-string (route class))
:do (cond
- ((stringp part)
+ ((or (stringp part) (characterp part))
(push part build-parts))
((symbolp part) nil)
((and (listp part)