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

Commit f8a84cf

Browse files
authored
Merge pull request #302 from laike9m/development
Fix integration test for Python 3
2 parents 80ecee4 + 2cdc92f commit f8a84cf

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Diff for: hyper/http20/util.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ def h2_safe_headers(headers):
5252
"""
5353
stripped = {
5454
i.lower().strip()
55-
for k, v in headers if k == 'connection'
56-
for i in v.split(',')
55+
for k, v in headers if k == b'connection'
56+
for i in v.split(b',')
5757
}
58-
stripped.add('connection')
58+
stripped.add(b'connection')
5959

6060
return [header for header in headers if header[0] not in stripped]

Diff for: test/test_hyper.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -1176,27 +1176,27 @@ def test_nghttp2_installs_correctly(self):
11761176
assert True
11771177

11781178
def test_stripping_connection_header(self):
1179-
headers = [('one', 'two'), ('connection', 'close')]
1180-
stripped = [('one', 'two')]
1179+
headers = [(b'one', b'two'), (b'connection', b'close')]
1180+
stripped = [(b'one', b'two')]
11811181

11821182
assert h2_safe_headers(headers) == stripped
11831183

11841184
def test_stripping_related_headers(self):
11851185
headers = [
1186-
('one', 'two'), ('three', 'four'), ('five', 'six'),
1187-
('connection', 'close, three, five')
1186+
(b'one', b'two'), (b'three', b'four'), (b'five', b'six'),
1187+
(b'connection', b'close, three, five')
11881188
]
1189-
stripped = [('one', 'two')]
1189+
stripped = [(b'one', b'two')]
11901190

11911191
assert h2_safe_headers(headers) == stripped
11921192

11931193
def test_stripping_multiple_connection_headers(self):
11941194
headers = [
1195-
('one', 'two'), ('three', 'four'), ('five', 'six'),
1196-
('connection', 'close'),
1197-
('connection', 'three, five')
1195+
(b'one', b'two'), (b'three', b'four'), (b'five', b'six'),
1196+
(b'connection', b'close'),
1197+
(b'connection', b'three, five')
11981198
]
1199-
stripped = [('one', 'two')]
1199+
stripped = [(b'one', b'two')]
12001200

12011201
assert h2_safe_headers(headers) == stripped
12021202

0 commit comments

Comments
 (0)