Skip to content

Commit 5926ef8

Browse files
committed
fix(declarative): preserve empty 205 responses
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9015c274-1215-4163-94db-643befd21f8d
1 parent ca54a60 commit 5926ef8

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎python/packages/declarative/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ and supports identity, gzip, and deflate
5454
responses, including up to four encoding stages. Unsupported encodings,
5555
incomplete encoded bodies, and trailing encoded data raise `httpx.DecodingError`.
5656
Empty encoded responses are validated unless the response is bodyless (HEAD,
57-
204, or 304). Deflate input is retained within the same bound until its wrapped
57+
204, 205, or 304). Deflate input is retained within the same bound until its wrapped
5858
or raw format can be validated.
5959
Explicit request `Accept-Encoding` headers and client values that differ from
6060
HTTPX's generated default are preserved but do not enable additional decoders.

‎python/packages/declarative/agent_framework_declarative/_workflows/_http_handler.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ async def _read_bounded_response(response: httpx.Response, limit: int) -> None:
370370
for encoding in response.headers.get("content-encoding", "").split(",")
371371
if encoding.strip().lower() != "identity" and encoding.strip()
372372
]
373-
if response.request.method == "HEAD" or response.status_code in {204, 304}:
373+
if response.request.method == "HEAD" or response.status_code in {204, 205, 304}:
374374
encodings = []
375375
if len(encodings) > 4:
376376
raise httpx.DecodingError("HTTP response has too many content encoding stages.", request=response.request)

‎python/packages/declarative/tests/test_default_http_request_handler.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ async def __aiter__(self) -> AsyncIterator[bytes]:
998998
assert stream.closed
999999
assert not client.is_closed
10001000

1001-
@pytest.mark.parametrize(("method", "status"), [("HEAD", 200), ("GET", 204), ("GET", 304)])
1001+
@pytest.mark.parametrize(("method", "status"), [("HEAD", 200), ("GET", 204), ("GET", 205), ("GET", 304)])
10021002
async def test_empty_bodyless_response_does_not_require_encoded_body(self, method: str, status: int) -> None:
10031003
stream = _ResponseStream([])
10041004
response = httpx.Response(status, headers={"Content-Encoding": "gzip"}, stream=stream)

0 commit comments

Comments
 (0)