]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Fix httplib endheaders if a message_body exists
authorAntoine Bertin <ant.bertin@gmail.com>
Mon, 8 Jun 2015 22:17:08 +0000 (00:17 +0200)
committerIvan Malison <imalison@uber.com>
Tue, 9 Jun 2015 07:59:43 +0000 (00:59 -0700)
Fixes #140

vcr/stubs/__init__.py

index 4b1ca862012c4d94fece3390fa4dc9ff1ef54da8..a5ec50daf638a4036d4b346531fd0deb16b6da8e 100644 (file)
@@ -204,13 +204,14 @@ class VCRConnection(object):
         # no need to check that here.
         self.real_connection.close()
 
-    def endheaders(self, *args, **kwargs):
+    def endheaders(self, message_body=None):
         """
-        Normally, this would atually send the request to the server.
+        Normally, this would actually send the request to the server.
         We are not sending the request until getting the response,
-        so bypass this method for now.
+        so bypass this part and just append the message body, if any.
         """
-        pass
+        if message_body is not None:
+            self._vcr_request.body = message_body
 
     def getresponse(self, _=False, **kwargs):
         '''Retrieve the response'''