Exhaust the stream by reading until the limit is reached or the client disconnects, returning the remaining data. .. versionchanged:: 2.3 Return the remaining data. .. versionchanged:: 2.2.3 Handle case where wrapped stream returns fewer bytes than r
(self)
| 517 | # client disconnecting early. |
| 518 | |
| 519 | def exhaust(self) -> bytes: |
| 520 | """Exhaust the stream by reading until the limit is reached or the client |
| 521 | disconnects, returning the remaining data. |
| 522 | |
| 523 | .. versionchanged:: 2.3 |
| 524 | Return the remaining data. |
| 525 | |
| 526 | .. versionchanged:: 2.2.3 |
| 527 | Handle case where wrapped stream returns fewer bytes than requested. |
| 528 | """ |
| 529 | if not self.is_exhausted: |
| 530 | return self.readall() |
| 531 | |
| 532 | return b"" |
| 533 | |
| 534 | def readinto(self, b: bytearray) -> int | None: # type: ignore[override] |
| 535 | size = len(b) |