Skip to content

Commit 0071d4e

Browse files
author
Gautam Kumar
committed
fix: normalize empty reason phrase to None in asyncio transport
The asyncio HTTP client was reporting an empty reason phrase as an empty string instead of None, inconsistent with the requests and httpx transports which normalize empty reason phrases to None. Changed the one-liner to coerce empty string to None so that Response.reason is consistent across all adapters.
1 parent 86b742d commit 0071d4e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/dexpace-sdk-http-stdlib/src/dexpace/sdk/http/stdlib/asyncio_http_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ async def _read(
232232
raise ServiceResponseError(f"Malformed status line: {status_line!r}")
233233
protocol = _PROTOCOL_BY_VERSION.get(parts[0], Protocol.HTTP_1_1)
234234
status = _parse_status(parts[1])
235-
reason = parts[2] if len(parts) > 2 else None
235+
reason = (parts[2] or None) if len(parts) > 2 else None
236236
headers = await self._read_headers(reader)
237237
body_bytes = await self._read_body(reader, headers)
238238
return AsyncResponse(

0 commit comments

Comments
 (0)