Skip to content

Streaming HTTP errors are parsed before the body is read #131

@saxon134

Description

@saxon134

GlobalRouter.stream() calls error_from_response() on the response returned by httpx.Client.send(..., stream=True) without first reading the response body. For a real streaming response, error_from_response() reaches response.json()/response.text before read() has been called, causing httpx.ResponseNotRead instead of the documented GlobalRouterError for a 4xx/5xx streaming endpoint. The async path has the same issue and should await result.aread() before normalization.

File: src/globalrouter/_client.py

Line: 214

Severity: medium

Summary: unread stream response in stream

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions