mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 17:45:35 +00:00
lets make url the actual url instead of just the path
This commit is contained in:
@@ -49,7 +49,7 @@ class Cassette(object):
|
||||
self.play_counts[request] += 1
|
||||
|
||||
def append(self, request, response):
|
||||
'''Add a pair of request, response to this cassette'''
|
||||
'''Add a request, response pair to this cassette'''
|
||||
self.data[request] = response
|
||||
|
||||
def response_of(self, request):
|
||||
@@ -63,7 +63,7 @@ class Cassette(object):
|
||||
return "<Cassette containing {0} recorded response(s)>".format(len(self))
|
||||
|
||||
def __len__(self):
|
||||
'''Return the number of request / response pairs stored in here'''
|
||||
'''Return the number of request,response pairs stored in here'''
|
||||
return len(self.data)
|
||||
|
||||
def __contains__(self, request):
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
class Request(object):
|
||||
|
||||
def __init__(self, host, port, method, url, body, headers):
|
||||
def __init__(self, host, port, method, path, body, headers):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.method = method
|
||||
self.url = url
|
||||
self.path = path
|
||||
self.body = body
|
||||
self.headers = frozenset(headers.items())
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return self.host + self.path
|
||||
|
||||
def __key(self):
|
||||
return (self.host, self.port, self.method, self.url, self.body, self.headers)
|
||||
return (self.host, self.port, self.method, self.path, self.body, self.headers)
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.__key())
|
||||
|
||||
@@ -50,7 +50,7 @@ class VCRConnectionMixin:
|
||||
host = self.host,
|
||||
port = self.port,
|
||||
method = method,
|
||||
url = url,
|
||||
path = url,
|
||||
body = body,
|
||||
headers = headers or {}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user