'Why aiohttp "unpacks" file?

app.router.add_static(
    '/' + config['prefix'] + '/',
    config['path'],
    show_index=True
)

File on server:

/path/name.ext.gz 53kB

Downloaded with browser and with aiohttp client:

name.ext.gz 270k

If i download file named filename.ext.gz from aiohttp server it adds Content-Encoding: gzip header so file saved unpacked with .gz extension.

< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< Content-Encoding: gzip
< Etag: "16efd6039819648c-d1ae"
< Last-Modified: Tue, 17 May 2022 08:08:20 GMT
< Content-Length: 53678
< Accept-Ranges: bytes
< Date: Tue, 17 May 2022 09:25:30 GMT
< Server: Python/3.10 aiohttp/3.8.1

How to fix it to not add Content-Encoding: gzip ?

How to add Content-Encoding: gzip for file compressed, but without gz extension? (for reducing storage on server)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source