Skip to content

Streaming HTTP errors raise ResponseNotRead #59

@saxon134

Description

@saxon134

GlobalRouter.stream() and stream_async() send requests with stream=True, then pass a >=400 response directly to error_from_response() without reading the body first. For a real streaming response, response.json()/response.text access raises httpx.ResponseNotRead, so callers do not receive the documented GlobalRouterError. Reproduce with a mock SyncByteStream returning a 400 JSON error body and calling client.stream(...); it raises ResponseNotRead. Read/aread the response before normalizing the error.

File: src/globalrouter/_client.py

Line: 214

Severity: medium

Summary: unread streaming response in globalrouter.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