aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)