Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
=======================================
Coverage 38.04% 38.04%
=======================================
Files 10 10
Lines 347 347
Branches 46 46
=======================================
Hits 132 132
Misses 215 215
|
|
Thanks @BurnzZ! The changes look good to me. Before merging, could you please double-check that the responses are indeed compressed? |
Manually confirmed that the responses are compressed. 👍 |
zyte_api/aio/client.py
Outdated
| # adds direct client support for brotli has been released after 3.8.1: | ||
| # https://github.com/aio-libs/aiohttp/commit/28ea32d2282728a94af73c87efd6ab314c14320e | ||
| if HAS_BROTLI: | ||
| headers['Accept-Encoding'] = 'br' |
There was a problem hiding this comment.
I think we should be doing this even after that commit is released, i.e. we should always set Accept-Encoding to br, and not to gzip, deflate, br.
Also, since we are requiring brotli as a dependency, using HAS_BROTLI should not be needed.
There was a problem hiding this comment.
You're right. 👍 Updated!
There was a problem hiding this comment.
I think previously it was fine as well - e.g. in an unlikely event that aiohttp's HAS_BROTLI logic would become different from "brotli library is installed", the code would still have worked, although with gzip instead of brotli.
There was a problem hiding this comment.
Feel free to merge it though, it's not a big deal.
Resolves #29
aiohttp >= 3.7.3sinceBrotlireplaced the oldbrotlipydep which was unmaintained.https://docs.aiohttp.org/en/stable/changes.html?highlight=brotli#id12
brheaders since the version with Brotli client support is not yet released.aio-libs/aiohttp@28ea32d
We don't have automated tests that's set up yet, but I've tested this manually that:
'Accept-Encoding': 'br'whenbrotliis installed.'Content-Encoding': 'br'is received.