diff options
author | colin <colin@cicadas.surf> | 2024-05-12 20:35:56 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2024-05-12 20:35:56 -0700 |
commit | 31b4519eceac7d12ca22fa5bf2e96035ee6003d0 (patch) | |
tree | de1fdda20e8d81cdac3810c9a7d9271db0c21aaa /src | |
parent | aa6f3256614a2b97cc8c46a84ad2de46add8a8b0 (diff) |
Fix: route builder bug;
Diffstat (limited to 'src')
-rw-r--r-- | src/endpoint.lisp | 17 |
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) |