aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

Force gzip compression in aiohttp web.StreamResponse

Open CaledoniaProject opened this issue 6 years ago • 1 comments

I use the following code to serve file download requests:

resp = web.StreamResponse(headers={
    'Server': 'Nginx', 
    'Content-Type': 'text/html',
    'Content-Disposition': 'attrachment; filename=' + filename
})
await resp.prepare(request)

How do I force gzip compression? The relevant document is missing on aiohttp's website.

CaledoniaProject avatar Feb 28 '20 00:02 CaledoniaProject

You can find relevant docs here

ttsia avatar Oct 08 '23 08:10 ttsia