Skip to content

Commit 552e01c

Browse files
authored
Fix 2.7 deprecation warning in middleware/stack (#2123)
1 parent a28d37a commit 552e01c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
* Your contribution here.
1010
* [#2115](https://github.com/ruby-grape/grape/pull/2115): Fix declared_params regression with multiple allowed types - [@stanhu](https://github.com/stanhu).
11+
* [#2123](https://github.com/ruby-grape/grape/pull/2123): Fix 2.7 deprecation warning in middleware/stack - [@Legogris](https://github.com/Legogris).
1112

1213
### 1.5.0 (2020/10/05)
1314

lib/grape/middleware/stack.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def [](i)
7070
middlewares[i]
7171
end
7272

73-
def insert(index, *args, &block)
73+
def insert(index, *args, **kwargs, &block)
7474
index = assert_index(index, :before)
75-
middleware = self.class::Middleware.new(*args, &block)
75+
middleware = self.class::Middleware.new(*args, **kwargs, &block)
7676
middlewares.insert(index, middleware)
7777
end
7878

@@ -83,8 +83,8 @@ def insert_after(index, *args, &block)
8383
insert(index + 1, *args, &block)
8484
end
8585

86-
def use(*args, &block)
87-
middleware = self.class::Middleware.new(*args, &block)
86+
def use(*args, **kwargs, &block)
87+
middleware = self.class::Middleware.new(*args, **kwargs, &block)
8888
middlewares.push(middleware)
8989
end
9090

0 commit comments

Comments
 (0)