diff --git a/ahserver/globalEnv.py b/ahserver/globalEnv.py index 38e681f..cefd270 100644 --- a/ahserver/globalEnv.py +++ b/ahserver/globalEnv.py @@ -52,7 +52,6 @@ async def stream_response(request, async_data_generator, content_type='text/html res = StreamResponse() if content_type: res.content_type = content_type - res.set_status(200) await res.prepare(request) async for d in async_data_generator(): if isinstance(d, bytes): @@ -62,6 +61,7 @@ async def stream_response(request, async_data_generator, content_type='text/html else: d = json.dumps(d) await res.write(d.encode('utf-8')) + await res.drain() await res.write_eof() return res