1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-10 09:35:34 +00:00

add requests class to sow the seeds of a custom matcher

This commit is contained in:
Kevin McCarthy
2013-08-07 19:09:21 -10:00
parent 0e003575a1
commit 87d27a7199
5 changed files with 170 additions and 163 deletions

View File

@@ -3,6 +3,8 @@
from httplib import HTTPConnection, HTTPSConnection, HTTPMessage
from cStringIO import StringIO
from vcr.request import Request
class VCRHTTPResponse(object):
"""
@@ -44,14 +46,15 @@ class VCRConnectionMixin:
def request(self, method, url, body=None, headers=None):
'''Persist the request metadata in self._vcr'''
self._request = {
'host': self.host,
'port': self.port,
'method': method,
'url': url,
'body': body,
'headers': headers or {},
}
self._request = Request(
host = self.host,
port = self.port,
method = method,
url = url,
body = body,
headers = headers or {}
)
# Check if we have a cassette set, and if we have a response saved.
# If so, there's no need to keep processing and we can bail
if self.cassette and self._request in self.cassette: