aboutsummaryrefslogtreecommitdiffstats
path: root/test/netlib/http/http1
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-06-01 09:58:01 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-06-01 09:58:01 +1200
commita061e4587772f4a87eb43d84f2ed358f7cc98fbd (patch)
tree1aba05c9d0d6f654fe946897dcb8b5d9127a3de2 /test/netlib/http/http1
parent06703542037d1c84b0dcb60c6d1c500a0d189e93 (diff)
parenta7abf8b731658b4e7ed8705f7a94a6a62f08d51d (diff)
downloadmitmproxy-a061e4587772f4a87eb43d84f2ed358f7cc98fbd.tar.gz
mitmproxy-a061e4587772f4a87eb43d84f2ed358f7cc98fbd.tar.bz2
mitmproxy-a061e4587772f4a87eb43d84f2ed358f7cc98fbd.zip
Merge branch 'master' of github.com:cortesi/mitmproxy
Diffstat (limited to 'test/netlib/http/http1')
-rw-r--r--test/netlib/http/http1/test_read.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/netlib/http/http1/test_read.py b/test/netlib/http/http1/test_read.py
index 974aa895..5285ac1d 100644
--- a/test/netlib/http/http1/test_read.py
+++ b/test/netlib/http/http1/test_read.py
@@ -7,11 +7,22 @@ from netlib.http.http1.read import (
read_request, read_response, read_request_head,
read_response_head, read_body, connection_close, expected_http_body_size, _get_first_line,
_read_request_line, _parse_authority_form, _read_response_line, _check_http_version,
- _read_headers, _read_chunked
+ _read_headers, _read_chunked, get_header_tokens
)
from netlib.tutils import treq, tresp, raises
+def test_get_header_tokens():
+ headers = Headers()
+ assert get_header_tokens(headers, "foo") == []
+ headers["foo"] = "bar"
+ assert get_header_tokens(headers, "foo") == ["bar"]
+ headers["foo"] = "bar, voing"
+ assert get_header_tokens(headers, "foo") == ["bar", "voing"]
+ headers.set_all("foo", ["bar, voing", "oink"])
+ assert get_header_tokens(headers, "foo") == ["bar", "voing", "oink"]
+
+
def test_read_request():
rfile = BytesIO(b"GET / HTTP/1.1\r\n\r\nskip")
r = read_request(rfile)