()
| 49 | |
| 50 | |
| 51 | def test_gzip(): |
| 52 | body = b"test 123" |
| 53 | compressor = zlib.compressobj(9, zlib.DEFLATED, zlib.MAX_WBITS | 16) |
| 54 | compressed_body = compressor.compress(body) + compressor.flush() |
| 55 | |
| 56 | headers = [(b"Content-Encoding", b"gzip")] |
| 57 | response = httpx.Response( |
| 58 | 200, |
| 59 | headers=headers, |
| 60 | content=compressed_body, |
| 61 | ) |
| 62 | assert response.content == body |
| 63 | |
| 64 | |
| 65 | def test_brotli(): |