|
16 | 16 | combine_repeated_headers, split_repeated_headers, h2_safe_headers
|
17 | 17 | )
|
18 | 18 | from hyper.common.headers import HTTPHeaderMap
|
19 |
| -from hyper.common.util import to_bytestring |
| 19 | +from hyper.common.util import to_bytestring, HTTPVersion |
20 | 20 | from hyper.compat import zlib_compressobj, is_py2
|
21 | 21 | from hyper.contrib import HTTP20Adapter
|
22 | 22 | import hyper.http20.errors as errors
|
@@ -82,6 +82,10 @@ def test_connections_can_parse_ipv6_hosts_and_ports(self):
|
82 | 82 | assert c.proxy_host == 'ffff:aaaa::1'
|
83 | 83 | assert c.proxy_port == 8443
|
84 | 84 |
|
| 85 | + def test_connection_version(self): |
| 86 | + c = HTTP20Connection('www.google.com') |
| 87 | + assert c.version is HTTPVersion.http20 |
| 88 | + |
85 | 89 | def test_ping(self, frame_buffer):
|
86 | 90 | def data_callback(chunk, **kwargs):
|
87 | 91 | frame_buffer.add_data(chunk)
|
@@ -1097,6 +1101,10 @@ def test_read_compressed_frames(self):
|
1097 | 1101 |
|
1098 | 1102 | assert received == b'this is test data'
|
1099 | 1103 |
|
| 1104 | + def test_response_version(self): |
| 1105 | + r = HTTP20Response(HTTPHeaderMap([(':status', '200')]), None) |
| 1106 | + assert r.version is HTTPVersion.http20 |
| 1107 | + |
1100 | 1108 |
|
1101 | 1109 | class TestHTTP20Adapter(object):
|
1102 | 1110 | def test_adapter_reuses_connections(self):
|
|
0 commit comments