mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
netlib: request.path can be None
This commit is contained in:
parent
e739517070
commit
403ac82a7d
@ -147,7 +147,10 @@ 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.
|
||||||
"""
|
"""
|
||||||
return _native(self.data.path)
|
if self.data.path is None:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return _native(self.data.path)
|
||||||
|
|
||||||
@path.setter
|
@path.setter
|
||||||
def path(self, path):
|
def path(self, path):
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user