]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
fix aiohttp response closing
authorLuiz Menezes <luiz.menezesf@gmail.com>
Thu, 4 Aug 2016 16:39:09 +0000 (13:39 -0300)
committerLuiz Menezes <luiz.menezesf@gmail.com>
Thu, 4 Aug 2016 16:39:09 +0000 (13:39 -0300)
vcr/stubs/aiohttp_stubs.py

index 5dcbb158546cca6cc648833cb87f7fc3dacea3f0..c9d1fc3837d4b335787dacb266951b59b0d52096 100644 (file)
@@ -18,7 +18,7 @@ class MockClientResponse(ClientResponse):
         return self.content.decode(encoding)
 
     async def release(self):
-        self.close()
+        pass
 
 
 def vcr_request(cassette, real_request):
@@ -40,6 +40,7 @@ def vcr_request(cassette, real_request):
             response.reason = vcr_response['status']['message']
             response.headers = vcr_response['headers']
 
+            response.close()
             return response
 
         if cassette.write_protected and cassette.filter_request(vcr_request):
@@ -58,7 +59,7 @@ def vcr_request(cassette, real_request):
                 'code': response.status,
                 'message': response.reason,
             },
-            'headers': response.headers,
+            'headers': dict(response.headers),
             'body': {'string': await response.text()},
             'url': response.url,
         }