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:
@@ -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')
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user