2020-01-03 10:08:33 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-10-26 14:08:27 -04:00
|
|
|
# partial backport of https://github.com/rails/rails/pull/38169
|
|
|
|
# this is in order to be able to re-order rack middlewares.
|
|
|
|
|
|
|
|
unless Rails::Configuration::MiddlewareStackProxy.method_defined?(:move)
|
|
|
|
module Rails
|
|
|
|
module Configuration
|
|
|
|
class MiddlewareStackProxy
|
|
|
|
def move(*args, &block)
|
|
|
|
@operations << ->(middleware) { middleware.send(__method__, *args, &block) }
|
|
|
|
end
|
|
|
|
ruby2_keywords(:move) if respond_to?(:ruby2_keywords, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Rails.application.config.middleware.move(1, ActionDispatch::RequestId)
|
2021-06-08 17:10:05 -04:00
|
|
|
Rails.application.config.middleware.insert(1, Labkit::Middleware::Rack)
|