[rh:requests] Work around partial read dropping data (#13599)

Authored by: Grub4K
This commit is contained in:
Simon Sawicki 2025-07-02 00:12:43 +02:00 committed by GitHub
parent ca5cce5b07
commit c2ff2dbaec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View file

@ -140,6 +140,10 @@ class RequestsResponseAdapter(Response):
def read(self, amt: int | None = None):
try:
# Work around issue with `.read(amt)` then `.read()`
# See: https://github.com/urllib3/urllib3/issues/3636
if amt is None:
amt = (1 << 31) - 1
# Interact with urllib3 response directly.
return self.fp.read(amt, decode_content=True)