aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/net/http/http1/test_read.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/mitmproxy/net/http/http1/test_read.py b/test/mitmproxy/net/http/http1/test_read.py
index b3589c92..4084c360 100644
--- a/test/mitmproxy/net/http/http1/test_read.py
+++ b/test/mitmproxy/net/http/http1/test_read.py
@@ -194,6 +194,17 @@ def test_expected_http_body_size():
treq(headers=Headers(content_length="42"))
) == 42
+ # more than 1 content-length headers with same value
+ assert expected_http_body_size(
+ treq(headers=Headers([(b'content-length', b'42'), (b'content-length', b'42')]))
+ ) == 42
+
+ # more than 1 content-length headers with conflicting value
+ with pytest.raises(exceptions.HttpSyntaxException):
+ expected_http_body_size(
+ treq(headers=Headers([(b'content-length', b'42'), (b'content-length', b'45')]))
+ )
+
# no length
assert expected_http_body_size(
treq(headers=Headers())