Commit ea5ec1d
feat(client): AsyncClient.stream() context manager
Adds AsyncClient.stream(method, url, **kwargs) as a
@contextlib.asynccontextmanager method on the client. Mirrors
httpx2.AsyncClient.stream() but auto-raises StatusError subclasses
on 4xx/5xx (consistent with client.get/post/etc.) with body
pre-read so exc.response.content is accessible.
Bypasses the middleware chain (v1 design decision — revisit if user
feedback warrants). Uses the shared _httpx2_exception_mapper and
_raise_on_status_error helpers extracted in the earlier refactor
commit, so dispatch logic stays in lockstep with _terminal.
Body consumption errors during 'async for chunk in response.aiter_bytes()'
propagate through the yield and get mapped to httpware exceptions
consistently.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 98681e0 commit ea5ec1d
2 files changed
Lines changed: 397 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
691 | 751 | | |
692 | 752 | | |
693 | 753 | | |
| |||
0 commit comments