| 120 | |
| 121 | |
| 122 | def test_zstd_multiframe(): |
| 123 | # test inspired by urllib3 test suite |
| 124 | data = ( |
| 125 | # Zstandard frame |
| 126 | zstd.compress(b"foo") |
| 127 | # skippable frame (must be ignored) |
| 128 | + bytes.fromhex( |
| 129 | "50 2A 4D 18" # Magic_Number (little-endian) |
| 130 | "07 00 00 00" # Frame_Size (little-endian) |
| 131 | "00 00 00 00 00 00 00" # User_Data |
| 132 | ) |
| 133 | # Zstandard frame |
| 134 | + zstd.compress(b"bar") |
| 135 | ) |
| 136 | compressed_body = io.BytesIO(data) |
| 137 | |
| 138 | headers = [(b"Content-Encoding", b"zstd")] |
| 139 | response = httpx.Response(200, headers=headers, content=compressed_body) |
| 140 | response.read() |
| 141 | assert response.content == b"foobar" |
| 142 | |
| 143 | |
| 144 | def test_multi(): |