From 201082d1afd6f794767e6fab00f7cc916b248db0 Mon Sep 17 00:00:00 2001 From: James Reeves Date: Wed, 11 Dec 2024 23:06:15 +0000 Subject: [PATCH] Rename :default-handler to :default-handlers --- src/duct/router/reitit.clj | 6 +++--- test/duct/router/reitit_test.clj | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/duct/router/reitit.clj b/src/duct/router/reitit.clj index 452f60f..f1ba007 100644 --- a/src/duct/router/reitit.clj +++ b/src/duct/router/reitit.clj @@ -52,7 +52,7 @@ (assoc opts :path path))) (defn- create-handlers - [{:keys [default-handler file-handlers resource-handlers]}] + [{:keys [default-handlers file-handlers resource-handlers]}] (concat (when file-handlers (->> (path-map->options file-handlers) @@ -60,8 +60,8 @@ (when resource-handlers (->> (path-map->options resource-handlers) (map ring/create-resource-handler))) - (when default-handler - (list (ring/create-default-handler default-handler))))) + (when default-handlers + (list (ring/create-default-handler default-handlers))))) (defmethod ig/init-key :duct.router/reitit [_ options] (let [opts (-> options diff --git a/test/duct/router/reitit_test.clj b/test/duct/router/reitit_test.clj index 886bf93..5deb061 100644 --- a/test/duct/router/reitit_test.clj +++ b/test/duct/router/reitit_test.clj @@ -45,13 +45,13 @@ :query-params {"x" "1"} :headers {"Accept" "application/json"}}))))) -(deftest default-handler-test +(deftest default-handlers-test (let [handler (constantly {:status 200, :body "Hello World"}) config {:duct.router/reitit {:routes {"/" {:get {:handler handler}} "/406" {:handler (constantly nil)}} - :default-handler + :default-handlers {:not-found (constantly {:status 404, :body "404"}) :method-not-allowed (constantly {:status 405, :body "405"}) :not-acceptable (constantly {:status 406, :body "406"})}}}