diff options
Diffstat (limited to 'lazybones.lisp')
-rw-r--r-- | lazybones.lisp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lazybones.lisp b/lazybones.lisp index c7be8d8..66192a2 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -195,6 +195,10 @@ list of values, in the case of success, or NIL in the case of failure." (request-method request) (request-routekey request))) +(defun method-match-for-dispatch-p (req-method ep-method) + "Either the arguments compare EQ or the first is :HEAD and the second is :GET." + (or (eq req-method ep-method) + (and (eq :head req-method) (eq :get ep-method)))) (defun find-endpoint-matching-key (app method key) "Returns a list. NIL represents failure to find match. @@ -203,7 +207,7 @@ Otherwise the result is (ENDPOINT . ARGS) where ENDPOINT is an endpoint instanceq and ARGS is a list of arguments to pass to ENDPOINT's handler function." (loop for endpoint in (app-endpoints app) - for match = (and (eql method (endpoint-method endpoint)) + for match = (and (method-match-for-dispatch-p method (endpoint-method endpoint)) (matches-routekey-p (endpoint-dispatch-pattern endpoint) key)) when match return (cons endpoint (when (listp match) match)))) |