MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / test_content_encoding

Function test_content_encoding

tests/test_client_request.py:882–893  ·  view source on GitHub ↗
(loop, conn)

Source from the content-addressed store, hash-verified

880
881@pytest.mark.usefixtures("parametrize_zlib_backend")
882async def test_content_encoding(loop, conn) -> None:
883 req = ClientRequest(
884 "post", URL("http://python.org/"), data="foo", compress="deflate", loop=loop
885 )
886 with mock.patch("aiohttp.client_reqrep.StreamWriter") as m_writer:
887 m_writer.return_value.write_headers = mock.AsyncMock()
888 resp = await req.send(conn)
889 assert req.headers["TRANSFER-ENCODING"] == "chunked"
890 assert req.headers["CONTENT-ENCODING"] == "deflate"
891 m_writer.return_value.enable_compression.assert_called_with("deflate")
892 await req.close()
893 resp.close()
894
895
896async def test_content_encoding_dont_set_headers_if_no_body(loop, conn) -> None:

Callers

nothing calls this directly

Calls 5

sendMethod · 0.95
closeMethod · 0.95
ClientRequestClass · 0.90
patchMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected