1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 09:13:23 +00:00

Respect urllib3.response.HTTPResponse.data

This commit is contained in:
Sebastian Pipping
2023-05-16 15:38:38 +02:00
committed by Kevin McCarthy
parent 00da5ac5af
commit fd1aaab3bf

View File

@@ -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)