httpx
httpx copied to clipboard
fix: resolve async stream resource leak on timeout
Hello everyone! I got an error when running the tests and saw that there was already a issue related to this (#3686)
Summary
Fix async stream resource leak that caused ResourceWarning in Trio, basically replacing ByteStream.aiter() async generator with a iterator that can be properly closed via aclose()
Checklist
- [X] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
- [X] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- [ ] I've updated the documentation accordingly.