            ;; Some endpoints are mapped to :all. That gets us to a leaf node,
            ;; which defines the handler (a wrapper around the endpoint function)
            ;; and the mapping of route parameters.
-           (if-let [{:keys [handler route-params]} (or (get dispatch request-method)
-                                                       (get dispatch :all))]
-             (-> request
-                 (assoc :route-params (medley/map-vals (partial nth request-path) route-params))
-                 handler)
-             ;; unsupported method for path
-             not-found-response)))))))
+           (or (invoke-leaf request request-method request-path dispatch)
+               not-found-response)))))))
 
 (defn- symbol-for-argument [arg]
   "Returns the argument symbol for an argument; this is either the argument itself or

        (recur analyze-state' (next entries))
        ;; Final step is to sort the routes:
        (-> analyze-state first map->sorted-routes)))))

(defn- map-traversal-dispatcher
  "Returns a Ring handler using the given dispatch-map to guide

                                            :always
                                            logging-middleware)]

                (add-dispatch-entries dispatch-map method pathvec request-handler metadata))))
          {}
          sorted-routes))

