Skip to content

fix: normalize empty reason phrase to None in asyncio transport#50

Merged
OmarAlJarrah merged 1 commit into
dexpace:mainfrom
GautamKumarOffical:fix/asyncio-reason-phrase-normalize
Jun 16, 2026
Merged

fix: normalize empty reason phrase to None in asyncio transport#50
OmarAlJarrah merged 1 commit into
dexpace:mainfrom
GautamKumarOffical:fix/asyncio-reason-phrase-normalize

Conversation

@GautamKumarOffical

Copy link
Copy Markdown
Contributor

Fixes #45

The asyncio HTTP client reports an empty reason phrase as an empty string instead of None, which is inconsistent with the requests and httpx transports that both normalize empty reason phrases to None.

This changes the one-liner to coerce an empty reason string to None so that Response.reason is consistent across all adapters.

# Before
reason = parts[2] if len(parts) > 2 else None

# After
reason = (parts[2] or None) if len(parts) > 2 else None

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.
@OmarAlJarrah OmarAlJarrah merged commit 026615f into dexpace:main Jun 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

asyncio transport reports an empty reason phrase as "" instead of None

2 participants