From 71ab563b2b0f4763ac266d6359fba492514bda65 Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 24 Aug 2024 10:31:37 -0700 Subject: Add: slot-value-mapper --- src/endpoint.lisp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/endpoint.lisp') diff --git a/src/endpoint.lisp b/src/endpoint.lisp index 00f681f..4ec68b6 100644 --- a/src/endpoint.lisp +++ b/src/endpoint.lisp @@ -356,6 +356,12 @@ the ;." :note "Error during the parsing of the body."))))))) + +(defun apply-slot-value-mappers (class initargs) + (loop :for (arg value) :on initargs :by #'cddr + :collect arg + :collect (slot-value-mapper class arg value))) + (defun instantiate-endpoint (class args) "This attempts to instantiate CLASS, filling slots found in ARGS by searching for their values in the hunchentoot:*request*. @@ -371,8 +377,10 @@ the ;." (body-args (extract-initargs args (collect-body class)))) (apply #'make-instance class - (reduce #'merge-plists - (list extracted-args params-args body-args))))) + (apply-slot-value-mappers + class + (reduce #'merge-plists + (list extracted-args params-args body-args)))))) (defun build-handler (class) "Create a hunchentoot dispatch function that instantiates and handles -- cgit v1.2.3