bugfix
This commit is contained in:
parent
08e40a7692
commit
0023e2eeca
@ -52,7 +52,6 @@ async def stream_response(request, async_data_generator, content_type='text/html
|
|||||||
res = StreamResponse()
|
res = StreamResponse()
|
||||||
if content_type:
|
if content_type:
|
||||||
res.content_type = content_type
|
res.content_type = content_type
|
||||||
res.set_status(200)
|
|
||||||
await res.prepare(request)
|
await res.prepare(request)
|
||||||
async for d in async_data_generator():
|
async for d in async_data_generator():
|
||||||
if isinstance(d, bytes):
|
if isinstance(d, bytes):
|
||||||
@ -62,6 +61,7 @@ async def stream_response(request, async_data_generator, content_type='text/html
|
|||||||
else:
|
else:
|
||||||
d = json.dumps(d)
|
d = json.dumps(d)
|
||||||
await res.write(d.encode('utf-8'))
|
await res.write(d.encode('utf-8'))
|
||||||
|
await res.drain()
|
||||||
await res.write_eof()
|
await res.write_eof()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user