Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed Aug 27, 2024
1 parent d8a8bce commit 5a2ae56
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions modules/reitit-ring/src/reitit/ring.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,10 @@
(defn routes
"Create a ring handler by combining several handlers into one."
{:arglists '([& handlers])}
([] nil)
([handler] handler)
([handler1 handler2]
(cond
(and handler1 handler2) (comp-handlers handler1 handler2)
handler1 handler1
handler2 handler2
:else nil))
([handler1 handler2 & handlers]
(reduce routes (routes handler1 handler2) handlers)))
([& [handler1 handler2 & handlers]]
(cond (seq handlers) (reduce routes (routes handler1 handler2) handlers)
(and handler1 handler2) (comp-handlers handler1 handler2)
:else (or handler1 handler2))))

(defn redirect-trailing-slash-handler
"A ring handler that redirects a missing path if there is an
Expand Down

0 comments on commit 5a2ae56

Please sign in to comment.