blob: 6d2f402fc51656314bc6271809a82dfe84386564 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
async def application(scope, receive, send):
assert scope['type'] == 'http'
body = b''
while True:
m = await receive()
body += m.get('body', b'')
if not m.get('more_body', False):
body = bytearray(body)
break
await send(
{
'type': 'http.response.start',
'status': 200,
'headers': [(b'content-length', str(len(body)).encode())],
}
)
await send({'type': 'http.response.body', 'body': body})
|