Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 0733c59

Browse files
committed
Add tests for unicode and byte string headers
1 parent c07ec28 commit 0733c59

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/test_hyper.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,33 @@ def test_putrequest_sends_data(self):
221221
assert len(sock.queue) == 2
222222
assert c._out_flow_control_window == 65535 - len(b'hello')
223223

224+
def test_different_request_headers(self):
225+
sock = DummySocket()
226+
227+
c = HTTP20Connection('www.google.com')
228+
c._sock = sock
229+
c.request('GET', '/', body='hello', headers={b'name': b'value'})
230+
s = c.recent_stream
231+
232+
assert list(s.headers.items()) == [
233+
(b':method', b'GET'),
234+
(b':scheme', b'https'),
235+
(b':authority', b'www.google.com'),
236+
(b':path', b'/'),
237+
(b'name', b'value'),
238+
]
239+
240+
c.request('GET', '/', body='hello', headers={u'name2': u'value2'})
241+
s = c.recent_stream
242+
243+
assert list(s.headers.items()) == [
244+
(b':method', b'GET'),
245+
(b':scheme', b'https'),
246+
(b':authority', b'www.google.com'),
247+
(b':path', b'/'),
248+
(b'name2', b'value2'),
249+
]
250+
224251
def test_closed_connections_are_reset(self):
225252
c = HTTP20Connection('www.google.com')
226253
c._sock = DummySocket()

0 commit comments

Comments
 (0)