Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions slack_bolt/adapter/falcon/async_resource.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime
from http import HTTPStatus

from falcon import MEDIA_TEXT
from falcon import version as falcon_version
from falcon.asgi import Request, Response
from slack_bolt import BoltResponse
Expand Down Expand Up @@ -40,9 +41,9 @@ async def on_get(self, req: Request, resp: Response):
await self._write_response(bolt_resp, resp)
return

resp.status = "404"
# Falcon 4.x w/ mypy fails to correctly infer the str type here
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mypy was actually functioning correctly - resp.body was removed long ago.

(All this could be replaced with a onliner raising HTTPNotFound, especially if you're OK with a JSON error.)

resp.body = "The page is not found..."
resp.status = HTTPStatus.NOT_FOUND
resp.content_type = MEDIA_TEXT
resp.text = "The page is not found..."

async def on_post(self, req: Request, resp: Response):
bolt_req = await self._to_bolt_request(req)
Expand Down