class ActionDispatch::MiddlewareStack

def swap(target, *args, &block)

def swap(target, *args, &block)
  index = assert_index(target, :before)
  insert(index, *args, &block)
  middlewares.delete_at(index + 1)
end