             (dotimes [_ 10]
               (is (= :request (app :request))))))))))
 
+(defn create-app [router]
+  (let [h (middleware/middleware-handler router)]
+    (fn [path]
+      (if-let [f (h path)]
+        (f [])))))
+
 (deftest middleware-handler-test
 
   (testing "all paths should have a handler"

                     ["/ping" handler]
                     ["/admin" {:middleware [[mw :admin]]}
                      ["/ping" handler]]]])
          ->app (fn [router]
                  (let [h (middleware/middleware-handler router)]
                    (fn [path]
                      (if-let [f (h path)]
                        (f [])))))
          app (->app router)]

      (testing "not found"
        (is (= nil (app "/favicon.ico"))))

                       ["/api" {:name ::api
                                :middleware [mw1 mw2 mw3 mw2]
                                :handler handler}])
              app (create-app router)]

          (is (= [::mw1 ::mw3 :ok ::mw3 ::mw1] (app "/api")))

