"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive",
- "content-length": "0",
"example-header": "example-value",
"host": "example.org",
"user-agent": f"python-httpx/{__version__}",
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive",
- "content-length": "0",
"host": "example.org",
"user-agent": "python-myclient/0.2.1",
"x-auth-token": "FooBarBazToken",
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive",
- "content-length": "0",
"host": "example.org",
"user-agent": f"python-httpx/{__version__}",
"x-auth-token": "BazToken",
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive",
- "content-length": "0",
"host": "example.org",
"user-agent": f"python-httpx/{__version__}",
}
"accept-encoding": "gzip, deflate, br",
"another-header": "AThing",
"connection": "keep-alive",
- "content-length": "0",
"host": "example.org",
"user-agent": "python-myclient/0.2.1",
}
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive",
- "content-length": "0",
"host": "example.org",
"user-agent": f"python-httpx/{__version__}",
"authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive",
- "content-length": "0",
"host": "example.org:123",
"user-agent": f"python-httpx/{__version__}",
"authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
response = await client.post(url, data=data)
assert response.url == URL("https://example.org/redirect_body_target")
assert response.json()["body"] == "Example request body"
- assert response.json()["headers"]["content-length"] == "20"
+ assert "content-length" in response.json()["headers"]
@pytest.mark.usefixtures("async_environment")
response = await client.post(url, data=data)
assert response.url == URL("https://example.org/redirect_body_target")
assert response.json()["body"] == ""
- assert response.json()["headers"]["content-length"] == "0"
+ assert "content-length" not in response.json()["headers"]
@pytest.mark.usefixtures("async_environment")
async_content = b"".join([part async for part in stream])
assert stream.can_replay()
- assert stream.get_headers() == {
- "Content-Length": "0",
- }
+ assert stream.get_headers() == {}
assert sync_content == b""
assert async_content == b""
async_content = b"".join([part async for part in stream])
assert stream.can_replay()
- assert stream.get_headers() == {
- "Content-Length": "0",
- }
+ assert stream.get_headers() == {}
assert sync_content == b""
assert async_content == b""