lib/lita/rack_app.rb in lita-4.0.1 vs lib/lita/rack_app.rb in lita-4.0.2
- old
+ new
@@ -13,10 +13,18 @@
# @param robot [Lita::Robot] The currently running robot.
# @return [Lita::RackApp, Class] The Rack application.
def self.build(robot)
builder = Rack::Builder.new
builder.run(new(robot))
- robot.config.http.middleware.each { |middleware| builder.use(middleware) }
+
+ robot.config.http.middleware.each do |wrapper|
+ if wrapper.block
+ builder.use(wrapper.middleware, *wrapper.args, &wrapper.block)
+ else
+ builder.use(wrapper.middleware, *wrapper.args)
+ end
+ end
+
builder.to_app
end
# @param robot [Lita::Robot] The currently running robot.
def initialize(robot)