add drain method to StreamingHTTPResponse
This commit is contained in:
parent
df47cf72d3
commit
c055cf912d
|
@ -120,6 +120,9 @@ class StreamingHTTPResponse(BaseHTTPResponse):
|
||||||
self.headers = headers or {}
|
self.headers = headers or {}
|
||||||
self._cookies = None
|
self._cookies = None
|
||||||
|
|
||||||
|
async def drain():
|
||||||
|
await self.stream_writer.drain()
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
"""Writes a chunk of data to the streaming response.
|
"""Writes a chunk of data to the streaming response.
|
||||||
|
|
||||||
|
|
|
@ -261,6 +261,7 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
try:
|
try:
|
||||||
keep_alive = self.keep_alive
|
keep_alive = self.keep_alive
|
||||||
response.transport = self.transport
|
response.transport = self.transport
|
||||||
|
response.stream_writer = asyncio.StreamWriter(self.transport, self)
|
||||||
await response.stream(
|
await response.stream(
|
||||||
self.request.version, keep_alive, self.request_timeout)
|
self.request.version, keep_alive, self.request_timeout)
|
||||||
if self.has_log:
|
if self.has_log:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user