Skip to content

Commit

Permalink
Add force reset around calls to actual connection from stubs, to ensure
Browse files Browse the repository at this point in the history
compatibility with version of httplib/urlib2 in python 2.7.9. Closes #130.
  • Loading branch information
colonelpanic8 committed Dec 26, 2014
1 parent 5301149 commit e1f65bc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions vcr/stubs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,16 @@ def getresponse(self, _=False):
self._vcr_request
)
)
self.real_connection.request(
method=self._vcr_request.method,
url=self._url(self._vcr_request.uri),
body=self._vcr_request.body,
headers=self._vcr_request.headers,
)
# This is imported here to avoid circular import.
# TODO(@IvanMalison): Refactor to allow normal import.
from vcr.patch import force_reset
with force_reset():
self.real_connection.request(
method=self._vcr_request.method,
url=self._url(self._vcr_request.uri),
body=self._vcr_request.body,
headers=self._vcr_request.headers,
)

# get the response
response = self.real_connection.getresponse()
Expand Down

0 comments on commit e1f65bc

Please sign in to comment.