Skip to content

chore: Decode async HTTP transport responses strictly - #489

Merged
jsonbailey merged 1 commit into
mainfrom
jb/sdk-60/async-transport-review
Aug 13, 2026
Merged

chore: Decode async HTTP transport responses strictly#489
jsonbailey merged 1 commit into
mainfrom
jb/sdk-60/async-transport-review

Conversation

@jsonbailey

@jsonbailey jsonbailey commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Overview

AsyncHTTPTransport.request decoded response bodies with errors='replace', which silently substitutes invalid bytes with the U+FFFD replacement character. That can mask a corrupt or misconfigured response instead of surfacing it.

This decodes strictly (await response.text(encoding='UTF-8')), matching the sync SDK's data.decode('UTF-8'). A malformed body now raises rather than being silently corrupted. Because AsyncHTTPTransport is the centralized async HTTP path, this covers both polling and event delivery.

The two other findings from the transport review — the missing allow_redirects=False and the absence of a response body-size cap — were triaged as non-divergences from the sync SDK (the SDK deliberately follows redirects on streaming and polling, and the sync SDK reads bodies unbounded), so they were intentionally left unchanged.


Note

Overview
Async HTTP transport now decodes response bodies with strict UTF-8 instead of errors='replace', so invalid bytes raise rather than being silently replaced with U+FFFD.

This aligns AsyncHTTPTransport.request with the sync SDK’s data.decode('UTF-8') behavior and affects all async HTTP callers that use this centralized path (polling and event delivery).

Reviewed by Cursor Bugbot for commit 81b76d1. Bugbot is set up for automated code reviews on this repo. Configure here.

@jsonbailey
jsonbailey requested a review from a team as a code owner August 13, 2026 14:57
@jsonbailey
jsonbailey merged commit ed7a7b7 into main Aug 13, 2026
17 checks passed
@jsonbailey
jsonbailey deleted the jb/sdk-60/async-transport-review branch August 13, 2026 16:08
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.

2 participants