diff --git a/sanic/asgi.py b/sanic/asgi.py index 3101a3de..52449819 100644 --- a/sanic/asgi.py +++ b/sanic/asgi.py @@ -255,7 +255,7 @@ class ASGIApp: return instance - async def read(self) -> None: + async def read(self) -> Optional[bytes]: """ Read and stream the body in chunks from an incoming ASGI message. """ diff --git a/sanic/http.py b/sanic/http.py index c659c3ca..646ab1e8 100644 --- a/sanic/http.py +++ b/sanic/http.py @@ -248,7 +248,7 @@ class Http: if size: return b"%x\r\n%b\r\n0\r\n\r\n" % (size, data) return b"0\r\n\r\n" - return b"%x\r\n%b\r\n" % (size, data) if size else None + return b"%x\r\n%b\r\n" % (size, data) if size else b"" def http1_response_normal(self, data: bytes, end_stream: bool) -> bytes: """Format / keep track of non-chunked response."""