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

Fix integration test for Python 3 #302

Merged
merged 1 commit into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hyper/http20/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def h2_safe_headers(headers):
"""
stripped = {
i.lower().strip()
for k, v in headers if k == 'connection'
for i in v.split(',')
for k, v in headers if k == b'connection'
for i in v.split(b',')
}
stripped.add('connection')
stripped.add(b'connection')

return [header for header in headers if header[0] not in stripped]
18 changes: 9 additions & 9 deletions test/test_hyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,27 +1176,27 @@ def test_nghttp2_installs_correctly(self):
assert True

def test_stripping_connection_header(self):
headers = [('one', 'two'), ('connection', 'close')]
stripped = [('one', 'two')]
headers = [(b'one', b'two'), (b'connection', b'close')]
stripped = [(b'one', b'two')]

assert h2_safe_headers(headers) == stripped

def test_stripping_related_headers(self):
headers = [
('one', 'two'), ('three', 'four'), ('five', 'six'),
('connection', 'close, three, five')
(b'one', b'two'), (b'three', b'four'), (b'five', b'six'),
(b'connection', b'close, three, five')
]
stripped = [('one', 'two')]
stripped = [(b'one', b'two')]

assert h2_safe_headers(headers) == stripped

def test_stripping_multiple_connection_headers(self):
headers = [
('one', 'two'), ('three', 'four'), ('five', 'six'),
('connection', 'close'),
('connection', 'three, five')
(b'one', b'two'), (b'three', b'four'), (b'five', b'six'),
(b'connection', b'close'),
(b'connection', b'three, five')
]
stripped = [('one', 'two')]
stripped = [(b'one', b'two')]

assert h2_safe_headers(headers) == stripped

Expand Down