-
Notifications
You must be signed in to change notification settings - Fork 248
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
Fix #370 by adding an alias of next
arg (next_
) in middleware arguments
#394
Conversation
…ware arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments for reviewers
@@ -87,6 +87,53 @@ def test_next_call(self): | |||
assert response.body == "acknowledged!" | |||
assert_auth_test_count(self, 1) | |||
|
|||
def test_decorator_next_call(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking these test patterns should be helpful for knowing the purpose of the changes.
@@ -45,10 +45,10 @@ def run_middleware( | |||
for m in self.middleware: | |||
middleware_state = {"next_called": False} | |||
|
|||
def next(): | |||
def next_(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an essential part of this PR. It's just a minor refactoring
@@ -52,6 +52,7 @@ def build_required_kwargs( | |||
"respond": request.context.respond, | |||
# middleware | |||
"next": next_func, | |||
"next_": next_func, # for the middleware using Python's built-in `next()` function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this enables bolt-python to resolve the alias name as well.
Codecov Report
@@ Coverage Diff @@
## main #394 +/- ##
=======================================
Coverage 91.60% 91.61%
=======================================
Files 167 167
Lines 5384 5388 +4
=======================================
+ Hits 4932 4936 +4
Misses 452 452
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! ✅
Just out of curiosity, is next_
a convention in Python? Rather than say nextMiddleware
.
I think |
This pull request fixes #370. The essential change in this pull request is to add
next_
to kwargs_injection names. With this fix, developers can usenext_
in addition tonext
in the middleware method arguments.Category (place an
x
in each of the[ ]
)slack_bolt.App
and/or its core componentsslack_bolt.async_app.AsyncApp
and/or its core componentsslack_bolt.adapter
/docs
Requirements (place an
x
in each[ ]
)Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.sh
after making the changes.