Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 288
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
1360098396ad67e1d8f7ebef16bb001d1de3d36fac16a467fb94bc2175858ccFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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; |
| 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() | ||
Uh oh!
There was an error while loading. Please reload this page.
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!