mirror of
https://github.com/vale981/myway
synced 2025-03-04 17:31:41 -05:00
Allow to specify ':route-class' for 'find-route'.
This commit is contained in:
parent
f565b360e3
commit
7be263e80a
2 changed files with 7 additions and 7 deletions
|
@ -14,6 +14,8 @@
|
|||
:route-handler
|
||||
:equal-route
|
||||
:match-route)
|
||||
(:import-from :alexandria
|
||||
:delete-from-plist)
|
||||
(:export :make-mapper
|
||||
:connect
|
||||
:next-route
|
||||
|
@ -42,14 +44,12 @@
|
|||
:name name
|
||||
:handler fn)))
|
||||
|
||||
(defun find-route (mapper url &key (method '(:GET)) regexp name)
|
||||
(defun find-route (mapper url &rest args &key method regexp name (route-class 'route) &allow-other-keys)
|
||||
(car
|
||||
(member-route mapper
|
||||
(make-instance 'route
|
||||
:url url
|
||||
:method method
|
||||
:regexp regexp
|
||||
:name name))))
|
||||
(apply #'make-instance route-class
|
||||
:url url
|
||||
(delete-from-plist args :route-class)))))
|
||||
|
||||
(defparameter *env* nil)
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
(handler :initarg :handler
|
||||
:accessor route-handler)))
|
||||
|
||||
(defmethod initialize-instance :after ((route route) &rest initargs &key url method regexp &allow-other-keys)
|
||||
(defmethod initialize-instance :after ((route route) &rest initargs &key url (method '(:GET)) regexp &allow-other-keys)
|
||||
(declare (ignore initargs))
|
||||
(setf (route-rule route)
|
||||
(make-rule url :method method :regexp regexp)))
|
||||
|
|
Loading…
Add table
Reference in a new issue