Reimplementing response tool in python to allow streaming put from stdin.

This commit is contained in:
Roberto Abdelkader Martínez Pérez committed 2019-04-29 13:01:54 +02:00
1 parent 503ac70963
commit de67e405c5
2 files changed
+34 -10

No files matched your search

+5 -1
View File
@@ -159,7 +159,11 @@ async def get_resource(request):
async def set_resource(request):
id = request.match_info["id"]
resource = request.match_info["resource"]
await CONNECTIONS[id].set(resource, request.content)
try:
await CONNECTIONS[id].set(resource, request.content)
except ConnectionResetError:
# Raised when trying to write to an already-closed stream.
request.transport.close()
return web.Response(body=b'')