diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-02-16 01:27:16 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-02-16 01:27:16 +0100 |
commit | 718e298dba59fda841e18c464c6a208660760c05 (patch) | |
tree | 3aec893567af03b3683ef147b57d8480fcbe0bef /test/netlib | |
parent | 4583fa79222d9b1d035efa0701fc03525747b46c (diff) | |
parent | a69d223b335894a5c9f7c006cf46a0cb4bc0ac43 (diff) | |
download | mitmproxy-718e298dba59fda841e18c464c6a208660760c05.tar.gz mitmproxy-718e298dba59fda841e18c464c6a208660760c05.tar.bz2 mitmproxy-718e298dba59fda841e18c464c6a208660760c05.zip |
Merge pull request #948 from fimad/master
Preserve host header when modifying request path
Diffstat (limited to 'test/netlib')
-rw-r--r-- | test/netlib/http/test_request.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/netlib/http/test_request.py b/test/netlib/http/test_request.py index 900b2cd1..7a6a9665 100644 --- a/test/netlib/http/test_request.py +++ b/test/netlib/http/test_request.py @@ -136,8 +136,10 @@ class TestRequestUtils(object): assert request.query.lst == [("bar", "42")] def test_set_query(self): - request = treq() + request = treq(host=b"foo", headers = Headers(host=b"bar")) request.query = ODict([]) + assert request.host == b"foo" + assert request.headers["host"] == b"bar" def test_get_cookies_none(self): request = treq() @@ -180,11 +182,14 @@ class TestRequestUtils(object): assert request.path_components == ["foo", "bar"] def test_set_path_components(self): - request = treq() + request = treq(host=b"foo", headers = Headers(host=b"bar")) request.path_components = ["foo", "baz"] assert request.path == "/foo/baz" request.path_components = [] assert request.path == "/" + request.query = ODict([]) + assert request.host == b"foo" + assert request.headers["host"] == b"bar" def test_anticache(self): request = treq() |