mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
fix sync do_request().stream
This commit is contained in:
@@ -51,8 +51,14 @@ class DoSyncRequest(BaseDoRequest):
|
||||
return self.client.request(*args, timeout=60, **kwargs)
|
||||
|
||||
def stream(self, *args, **kwargs):
|
||||
with self.client.stream(*args, **kwargs) as response:
|
||||
return b"".join(response.iter_bytes())
|
||||
if hasattr(self, "_client"):
|
||||
with self.client.stream(*args, **kwargs) as response:
|
||||
return b"".join(response.iter_bytes())
|
||||
|
||||
# Use one-time context and dispose of the client afterwards
|
||||
with self:
|
||||
with self.client.stream(*args, **kwargs) as response:
|
||||
return b"".join(response.iter_bytes())
|
||||
|
||||
|
||||
class DoAsyncRequest(BaseDoRequest):
|
||||
|
||||
Reference in New Issue
Block a user