From 6cbc0fb2793b356ee97bd260724de95bb903b4c1 Mon Sep 17 00:00:00 2001 From: Antoine Bertin Date: Tue, 9 Jun 2015 00:17:08 +0200 Subject: [PATCH] Fix httplib endheaders if a message_body exists Fixes #140 --- vcr/stubs/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py index 4b1ca86..a5ec50d 100644 --- a/vcr/stubs/__init__.py +++ b/vcr/stubs/__init__.py @@ -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'''