mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
Respect urllib3.response.HTTPResponse.data
This commit is contained in:
committed by
Kevin McCarthy
parent
00da5ac5af
commit
fd1aaab3bf
@@ -249,12 +249,13 @@ class VCRConnection:
|
||||
|
||||
# get the response
|
||||
response = self.real_connection.getresponse()
|
||||
response_data = response.data if hasattr(response, "data") else response.read()
|
||||
|
||||
# put the response into the cassette
|
||||
response = {
|
||||
"status": {"code": response.status, "message": response.reason},
|
||||
"headers": serialize_headers(response),
|
||||
"body": {"string": response.read()},
|
||||
"body": {"string": response_data},
|
||||
}
|
||||
self.cassette.append(self._vcr_request, response)
|
||||
return VCRHTTPResponse(response)
|
||||
|
||||
Reference in New Issue
Block a user