MCPcopy
hub / github.com/urllib3/urllib3 / stream

Method stream

test/test_response.py:1692–1698  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1690 """Show that we can decode the gzipped and chunked body."""
1691
1692 def stream() -> typing.Generator[bytes]:
1693 # Set up a generator to chunk the gzipped body
1694 compress = zlib.compressobj(6, zlib.DEFLATED, 16 + zlib.MAX_WBITS)
1695 data = compress.compress(b"foobar")
1696 data += compress.flush()
1697 for i in range(0, len(data), 2):
1698 yield data[i : i + 2]
1699
1700 fp = MockChunkedEncodingResponse(list(stream()))
1701 r = httplib.HTTPResponse(MockSock) # type: ignore[arg-type]

Calls 1

flushMethod · 0.45

Tested by

no test coverage detected