diff --git a/httpx/_content.py b/httpx/_content.py index 6f479a0885..f4acfc4045 100644 --- a/httpx/_content.py +++ b/httpx/_content.py @@ -61,7 +61,11 @@ def __iter__(self) -> Iterator[bytes]: else: # Otherwise iterate. for part in self._stream: - yield part + # For bytes types, should use yield to send data in + # chunks. Sending a very large part at once will + # result in extremely slow transmission. + for i in range(0, len(part), self.CHUNK_SIZE): + yield part[i : i + self.CHUNK_SIZE] class AsyncIteratorByteStream(AsyncByteStream):