-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Positioning a new middleware in stack #1659
Comments
I've seen this being done by adding behavior to the See https://github.com/rapid7/metasploit-framework/pull/12980/files#diff-450c1438fd1939e93afa67f321933d2b44a8b254ad6ce4616d08269588b623e6 for the example I tried it myself over at https://github.com/dentarg/gists/tree/10d569f00b83d549395c18a4cb87462670b91e1c/gists/sinatra-insert-middleware and it seems to work still You can also call |
Also remove the very old[1] `does not include ...` comment. Fighting the test I had to change made me realize just how much the order of middlewares matters. Not very intuitive 😞. Maybe someday someone will get to sinatra#1659 Close sinatra#1930 1: sinatra@0985552
Hello, I'd like to place a particular middleware first in the middleware stack but i notice that theres not a method in
Sinatra::Base
to accomplish this. The only method available isdef use(middleware, *args, &block)
which will be placed at the bottom of the stack. I was looking for something similar to Railsconfig.middleware.insert_before(existing_middleware, new_middleware, args)
. Can we have a feature for this? In the meanwhile, how can I extend Sinatra / Base to insert a middleware at a certain position on the stack?The text was updated successfully, but these errors were encountered: