Is it possible on an aiohttp server to send an uploaded file to another server without loading it into memory? How can I do that?
async def forward_huge_upload_to_upstream(request):
reader = await request.multipart()
field = await reader.next()
filename = field.filename
data = FormData()
data.add_field('data', ???, filename=field.filename, content_type=field.headers['Conent-Type'])
async with aiohttp.ClientSession() as session:
async with session.post(url, data=data) as response:
return web.Response(status=response.status, body=await response.text())