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

Add support for calling httplib.send().

This commit changes the whole core internal flow of requests.
Now, requests are actually physically made lazily when a response
is requested.  This allows the entire request to be sent at once.

Otherwise, it would be impossible to compare whether requests have
already been recorded, since httplib.send() allows you to effectively
stream requests over HTTP.
This commit is contained in:
Kevin McCarthy
2013-09-15 10:47:24 -10:00
parent 07774ae6dd
commit 5ce67dc023
4 changed files with 125 additions and 13 deletions

View File

@@ -25,7 +25,11 @@ except ImportError: # pragma: no cover
def install(cassette):
'''Install a cassette in lieu of actuall fetching'''
"""
Patch all the HTTPConnections references we can find!
This replaces the actual HTTPConnection with a VCRHTTPConnection
object which knows how to save to / read from cassettes
"""
httplib.HTTPConnection = httplib.HTTP._connection_class = VCRHTTPConnection
httplib.HTTPSConnection = httplib.HTTPS._connection_class = (
VCRHTTPSConnection)