aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2016-05-14 10:14:42 -0700
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-05-14 10:14:42 -0700
commitf4a13d6f9f804b8883e415a1e2eb6beb129e5b7f (patch)
treea1774ce432d21d51f3da5b578a33b05a97089012 /test
parent7fdc0a94db657ecc7a361004f1924fc30a2e4329 (diff)
downloadmitmproxy-f4a13d6f9f804b8883e415a1e2eb6beb129e5b7f.tar.gz
mitmproxy-f4a13d6f9f804b8883e415a1e2eb6beb129e5b7f.tar.bz2
mitmproxy-f4a13d6f9f804b8883e415a1e2eb6beb129e5b7f.zip
http2: improve header tests (#1143) (#1144)
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_protocol_http2.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/mitmproxy/test_protocol_http2.py b/test/mitmproxy/test_protocol_http2.py
index ceb9bbb2..dcb6ff3c 100644
--- a/test/mitmproxy/test_protocol_http2.py
+++ b/test/mitmproxy/test_protocol_http2.py
@@ -162,16 +162,19 @@ class TestSimple(_Http2TestBase, _Http2ServerBase):
if isinstance(event, h2.events.ConnectionTerminated):
return False
elif isinstance(event, h2.events.RequestReceived):
- h2_conn.send_headers(1, [
+ assert ('client-foo', 'client-bar-1') in event.headers
+ assert ('client-foo', 'client-bar-2') in event.headers
+
+ h2_conn.send_headers(event.stream_id, [
(':status', '200'),
- ('foo', 'bar'),
+ ('server-foo', 'server-bar'),
('föo', 'bär'),
+ ('X-Stream-ID', str(event.stream_id)),
])
- h2_conn.send_data(1, b'foobar')
- h2_conn.end_stream(1)
+ h2_conn.send_data(event.stream_id, b'foobar')
+ h2_conn.end_stream(event.stream_id)
wfile.write(h2_conn.data_to_send())
wfile.flush()
-
return True
def test_simple(self):
@@ -182,6 +185,8 @@ class TestSimple(_Http2TestBase, _Http2ServerBase):
(':method', 'GET'),
(':scheme', 'https'),
(':path', '/'),
+ ('ClIeNt-FoO', 'client-bar-1'),
+ ('ClIeNt-FoO', 'client-bar-2'),
], body='my request body echoed back to me')
done = False
@@ -203,7 +208,7 @@ class TestSimple(_Http2TestBase, _Http2ServerBase):
assert len(self.master.state.flows) == 1
assert self.master.state.flows[0].response.status_code == 200
- assert self.master.state.flows[0].response.headers['foo'] == 'bar'
+ assert self.master.state.flows[0].response.headers['server-foo'] == 'server-bar'
assert self.master.state.flows[0].response.headers['föo'] == 'bär'
assert self.master.state.flows[0].response.body == b'foobar'