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

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-04-29 13:01:37 +02:00
parent 503ac70963
commit de67e405c5
2 changed files with 34 additions and 10 deletions
+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'')