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

lets store the proto too

This commit is contained in:
Kevin McCarthy
2013-08-10 13:33:10 -10:00
parent 59567a26cc
commit ec01955c68
3 changed files with 18 additions and 3 deletions

View File

@@ -1,16 +1,19 @@
class Request(object):
def __init__(self, host, port, method, path, body, headers):
def __init__(self, protocol, host, port, method, path, body, headers):
self.protocol = protocol
self.host = host
self.port = port
self.method = method
self.path = path
self.body = body
# make haders a frozenset so it will be hashable
self.headers = frozenset(headers.items())
@property
def url(self):
return self.host + self.path
print self.protocol, self.host, self.path
return "{0}://{1}{2}".format(self.protocol, self.host, self.path)
def __key(self):
return (self.host, self.port, self.method, self.path, self.body, self.headers)
@@ -22,4 +25,4 @@ class Request(object):
return hash(self) == hash(other)
def __str__(self):
return "<Request ({0}) {1}>".format(self.method, self.body)
return "<Request ({0}) {1}>".format(self.method, self.url)