         (do
           (when-not (string? uri-pattern)
             (i/expected "URI pattern to be retrievable as a string value" spec))
-          (assoc spec :matcher
-            (let [uri-template (i/parse-uri-template i/default-separator uri-pattern)]
-              (fn [request]
-                (when-let [params (Util/matchURI ^String (:uri request) uri-template)]
-                  {:params params})))))
+          (let [uri-template (i/parse-uri-template i/default-separator uri-pattern)
+                ensure-matchex (make-ensurer :matchex
+                                 (fn [spec x]
+                                   (assoc spec :matchex x)))]
+            (-> spec
+              (assoc :matcher (fn [request]
+                                (when-let [params (Util/matchURI ^String (:uri request) uri-template)]
+                                  {:params params})))
+              (ensure-matchex (fn [request]
+                                `(when-let [params# (Util/matchURI ^String (:uri ~request) ~uri-template)]
+                                   {:params params#}))))))
         spec))))
 
 

      (when-not (map? spec)
        (i/expected "route spec to be a map" spec))
      (if-let [method (method-finder spec)]  ; assoc matcher only if method matcher is intended
        (do
          (when-not (or (keyword? method)
                      (and (set? method)
                        (every? keyword? method)))
            (i/expected "HTTP method key to be retrievable as a keyword or keyword-set value" spec))
          (assoc spec :matcher
            (cond
              (keyword? method) (fn [request]
                                  (when (= (:request-method request) method)
                                    {}))
              (set? method)     (fn [request]
                                  (when (method (:request-method request))
                                    {})))))
        spec))))



                               expr)
                             ([expr idx]
                               (let [matcher-sym (get matcher-syms idx)
                                     matcher-exp (if-let [matchex (:matchex (get routes idx))]
                                                   (matchex request-sym)
                                                   `(~matcher-sym ~request-sym))
                                     handler-sym (get handler-syms idx)]
                                 `(if-let [match# ~matcher-exp]
                                    (let [request# (get match# :request ~request-sym)
                                          ^Map params#  (get match# :params)]
                                      (~handler-sym request#
