Skip to content

Commit

Permalink
chore: update outdated keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kkharji committed Jan 3, 2022
1 parent 9ae212f commit 8331954
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Full configuration demo:
;; Coercion configuration
:duct.reitit/coercion {:enable true
:coercer 'spec ; Coercer to be used
:pretty-coercion? true ; Whether to pretty print coercion errors
:pretty? true ; Whether to pretty print coercion errors
:formater nil} ; Function that takes spec validation error map and format it

;; Cross-origin configuration, the following defaults in for dev profile
Expand Down
4 changes: 2 additions & 2 deletions src/duct/reitit/middleware.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
:id (java.util.UUID/randomUUID)
:start-date (java.util.Date.)})))

(defn- get-coercion-middleware [{:keys [pretty-print?] :as coercion}]
(defn- get-coercion-middleware [{:keys [pretty?] :as coercion}]
(when coercion
{:coerce-exceptions (when-not pretty-print? rcc/coerce-exceptions-middleware)
{:coerce-exceptions (when-not pretty? rcc/coerce-exceptions-middleware)
:coerce-request rcc/coerce-request-middleware
:coerce-response rcc/coerce-response-middleware}))

Expand Down
4 changes: 2 additions & 2 deletions src/duct/reitit/middleware/exception.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
(fn [exception request] ;; TODO: format
(handler exception request)))))

(defn coercion-handlers [{:keys [pretty-print? formatter]}]
(let [printer (when pretty-print? (try-resolve-sym 'expound.alpha/custom-printer))]
(defn coercion-handlers [{:keys [pretty? formatter]}]
(let [printer (when pretty? (try-resolve-sym 'expound.alpha/custom-printer))]
(when (or printer formatter)
#:reitit.coercion
{:request-coercion (coercion-error-handler 400 printer formatter)
Expand Down
2 changes: 1 addition & 1 deletion test/duct/reitit/middleware_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
(is (not (str/includes? (:body requestc) "github"))))))

(testing "Coercion Pretty Exception"
(let [middleware (new-middleware {:munntaja false :coercion {:pretty-print? true}})
(let [middleware (new-middleware {:munntaja false :coercion {:pretty? true}})
app (->> {:middleware middleware :environment environment}
(new-router routes)
(ring/ring-handler))
Expand Down
2 changes: 1 addition & 1 deletion test/duct/reitit_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
;; Coercion configuration
:duct.reitit/coercion {:enable true
:coercer 'spec ; Coercer to be used
:pretty-coercion? true ; Whether to pretty print coercion errors
:pretty? true ; Whether to pretty print coercion errors
:formater nil} ; Function that takes spec validation error map and format it

;; Cross-origin configuration, the following defaults in for dev and local profile
Expand Down

0 comments on commit 8331954

Please sign in to comment.