aboutsummaryrefslogtreecommitdiffstats
path: root/test/http/http1/test_assemble.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/http/http1/test_assemble.py')
-rw-r--r--test/http/http1/test_assemble.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/http/http1/test_assemble.py b/test/http/http1/test_assemble.py
index 460e22c5..ed94292d 100644
--- a/test/http/http1/test_assemble.py
+++ b/test/http/http1/test_assemble.py
@@ -78,10 +78,19 @@ def test_assemble_request_headers():
# https://github.com/mitmproxy/mitmproxy/issues/186
r = treq(content=b"")
r.headers["Transfer-Encoding"] = "chunked"
- c = _assemble_request_headers(r)
+ c = _assemble_request_headers(r.data)
assert b"Transfer-Encoding" in c
- assert b"host" in _assemble_request_headers(treq(headers=Headers()))
+
+def test_assemble_request_headers_host_header():
+ r = treq()
+ r.headers = Headers()
+ c = _assemble_request_headers(r.data)
+ assert b"host" in c
+
+ r.host = None
+ c = _assemble_request_headers(r.data)
+ assert b"host" not in c
def test_assemble_response_headers():