-
Notifications
You must be signed in to change notification settings - Fork 292
fix: align WSGI/ASGI test infrastructure and handler with spec #1513
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
Merged
+230
−112
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1360098
chore(deps-dev): update tornado requirement from <7,>=6 to >=6.5.6,<7
dependabot[bot] 396ad67
Update adapter_dev.txt
WilliamBergamin e1d8f7e
fix: align WSGI/ASGI test infrastructure and handler with spec
WilliamBergamin bef16bb
Merge branch 'main' into imporve-asgi-wsgi-remove-deps
WilliamBergamin 001d1de
need asgiref
WilliamBergamin 3d36fac
imrove wsgi adapter to match standard
WilliamBergamin 16a467f
Improve asgi adapter behavior
WilliamBergamin b94bc21
improve readability
WilliamBergamin 75858cc
Merge branch 'main' into imporve-asgi-wsgi-remove-deps
WilliamBergamin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| # pip install -r requirements/test_adapter.txt | ||
| moto>=3,<6 # For AWS tests | ||
| docker>=5,<8 # Used by moto | ||
| boddle>=0.2.9,<0.3 # For Bottle app tests | ||
| sanic-testing>=0.7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| # pip install -r requirements/test_async.txt | ||
| -r test.txt | ||
| -r async_dev.txt | ||
| asgiref>=3.7.2,<3.8; python_version<"3.9" | ||
| asgiref>=3.8,<4; python_version>="3.9" | ||
| pytest-asyncio<2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| from typing import Any, Callable, Dict, Iterable, List, Tuple | ||
| from typing import TYPE_CHECKING, Iterable | ||
|
|
||
| from slack_bolt import App | ||
|
|
||
| if TYPE_CHECKING: | ||
| from wsgiref.types import StartResponse, WSGIEnvironment | ||
|
|
||
| from slack_bolt.adapter.wsgi.http_request import WsgiHttpRequest | ||
| from slack_bolt.adapter.wsgi.http_response import WsgiHttpResponse | ||
| from slack_bolt.request import BoltRequest | ||
|
|
@@ -69,14 +73,17 @@ def _get_http_response(self, request: WsgiHttpRequest) -> WsgiHttpResponse: | |
|
|
||
| def __call__( | ||
| self, | ||
| environ: Dict[str, Any], | ||
| start_response: Callable[[str, List[Tuple[str, str]]], None], | ||
| environ: "WSGIEnvironment", | ||
| start_response: "StartResponse", | ||
|
Comment on lines
+76
to
+77
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🪬 praise: Super meaningful improvement to building with confidence! |
||
| ) -> Iterable[bytes]: | ||
| request = WsgiHttpRequest(environ) | ||
| if "HTTP" in request.protocol: | ||
| if request.protocol.startswith("HTTP"): | ||
| response: WsgiHttpResponse = self._get_http_response( | ||
| request=request, | ||
| ) | ||
| start_response(response.status, response.get_headers()) | ||
| return response.get_body() | ||
| raise TypeError(f"Unsupported SERVER_PROTOCOL: {request.protocol}") | ||
| else: | ||
| response = WsgiHttpResponse( | ||
| status=400, headers={"content-type": ["text/plain;charset=utf-8"]}, body="Bad Request" | ||
| ) | ||
| start_response(response.status, response.get_headers()) | ||
| return response.get_body() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🐍 praise: Thank you for keeping this minimal!