Skip to content

Adding middleware keyword to a route definition can change the order of middleware #296

Description

@johnmcconnell

Using the list (https://clojuredocs.org/clojure.core/list) data structure to define the main middleware:

Before

(ring/router
  ["/" {:handler h-fn}]
  :data {:middleware (cons m1 [m2 m3 m4])})

Works as expected

After

(ring/router
  ["/" {:handler h-fn
          :middleware []}]
  :data {:middleware (cons m1 [m2 m3 m4])})

Now the middleware chain is executed out of order

FYI I didn't verify this, but I am fairly confident this happens or something like this happens

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions