diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2024-10-14 23:39:55 +0200 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2024-10-14 23:39:55 +0200 |
commit | 1be9ab5f5a929153b4a8193f6c12bab45fd00ab2 (patch) | |
tree | 4862ab90b5d2fb976ce5d1a07e02fa09e43c083c | |
parent | 1014236db9ca98612ea3fdcdf1f074e3855a446c (diff) |
Fix issues with query and fragment binding
-rw-r--r-- | src/routes.lisp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/routes.lisp b/src/routes.lisp index 8303b14..272d579 100644 --- a/src/routes.lisp +++ b/src/routes.lisp @@ -79,15 +79,13 @@ ((not slot) (error "")) ((symbolp slot) - `(,slot (assoc-value ,alist ',(symbol-name slot) - :test #'string-equal))) + `((,slot (assoc-value ,alist ',(symbol-name slot) + :test #'string-equal)))) ((listp slot) (destructuring-bind (var &key init-form name suppliedp) slot - `(,var (or (assoc-value ,alist ',name :test #'equal) - ,(if suppliedp - `(progn (setf ,suppliedp t) ,init-form) - init-form))))) + `(,@(if suppliedp `((,suppliedp t)) '()) + (,var (or (assoc-value ,alist ',name :test #'equal) ,init-form))))) (t (error "")))) @@ -100,9 +98,8 @@ ((listp slot) (destructuring-bind (var &optional init-form suppliedp) slot - `((,var (or ,value ,(if suppliedp - `(progn (setf ,suppliedp t) ,init-form) - init-form)))))) + `(,@(if suppliedp `((,suppliedp t)) '()) + (,var (or ,value ,init-form))))) (t (error "")))) @@ -158,8 +155,8 @@ route handles different methods." (let (,@(append (mapcar (rcurry #'path-binding path-alist) (remove-if-not #'symbolp path)) - (mapcar (rcurry #'query-binding query-alist) - query) + (mappend (rcurry #'query-binding query-alist) + query) (fragment-binding fragment fragment-value) (if headers `((,headers ,headers-value)) '()))) ,@body)))))) |