From 31b4519eceac7d12ca22fa5bf2e96035ee6003d0 Mon Sep 17 00:00:00 2001 From: colin Date: Sun, 12 May 2024 20:35:56 -0700 Subject: Fix: route builder bug; --- src/endpoint.lisp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/endpoint.lisp') 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 )" 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 )" + 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) -- cgit v1.2.3