1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Added test and impl for Request 'host' attribute

This commit is contained in:
Max Shytikov
2014-04-07 01:08:57 +02:00
parent 6cca703eee
commit 18ec57fa73
2 changed files with 8 additions and 0 deletions

View File

@@ -37,5 +37,6 @@ def test_url_matcher():
def test_metchers(): def test_metchers():
assert_matcher('method') assert_matcher('method')
assert_matcher('host')
#assert_matcher('method') #assert_matcher('method')
#assert_matcher('method') #assert_matcher('method')

View File

@@ -1,3 +1,6 @@
from six.moves.urllib.parse import urlparse, parse_qsl
class Request(object): class Request(object):
def __init__(self, method, uri, body, headers): def __init__(self, method, uri, body, headers):
@@ -12,6 +15,10 @@ class Request(object):
tmp[key] = value tmp[key] = value
self.headers = frozenset(tmp.iteritems()) self.headers = frozenset(tmp.iteritems())
@property
def host(self):
return urlparse(self.uri).hostname
@property @property
def url(self): def url(self):
return self.uri return self.uri