Add ability to return Falsey but not-None from handlers (#2236)

This commit is contained in:
Adam Hopkins
2021-09-12 07:19:26 +03:00
committed by GitHub
parent ef4f058a6c
commit a937e08ef0
2 changed files with 16 additions and 2 deletions

View File

@@ -839,7 +839,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
if isawaitable(response):
response = await response
if response:
if response is not None:
response = await request.respond(response)
elif not hasattr(handler, "is_websocket"):
response = request.stream.response # type: ignore