httpx
httpx copied to clipboard
fix: httpx.Client is slow when sending large data
This commit addresses an issue where sending large data with httpx.Client was extremely slow. The problem was that the entire data payload was being loaded into memory and sent in a single operation.
This fix refactors the sending process for iterable bytes types to use a chunked approach with yield, which significantly improves performance and reduces memory usage for large payloads.
Summary
pip install httpx==0.27.0
test case ref https://github.com/encode/httpcore/issues/1029, close issue https://github.com/encode/httpx/issues/3660
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.