netlib: request.path can be None

This commit is contained in:
Maximilian Hils 2016-03-20 23:22:50 +01:00
parent e739517070
commit 403ac82a7d
2 changed files with 10 additions and 2 deletions

View File

@ -147,6 +147,9 @@ class Request(Message):
HTTP request path, e.g. "/index.html". HTTP request path, e.g. "/index.html".
Guaranteed to start with a slash. Guaranteed to start with a slash.
""" """
if self.data.path is None:
return None
else:
return _native(self.data.path) return _native(self.data.path)
@path.setter @path.setter

View File

@ -41,7 +41,12 @@ class TestRequestCore(object):
_test_passthrough_attr(treq(), "port") _test_passthrough_attr(treq(), "port")
def test_path(self): def test_path(self):
_test_decoded_attr(treq(), "path") req = treq()
_test_decoded_attr(req, "path")
# path can also be None.
req.path = None
assert req.path is None
assert req.data.path is None
def test_host(self): def test_host(self):
if six.PY2: if six.PY2: