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

Commit

Permalink
Merge pull request #302 from laike9m/development
Browse files Browse the repository at this point in the history
Fix integration test for Python 3
  • Loading branch information
Lukasa committed Jan 17, 2017
2 parents 80ecee4 + 2cdc92f commit f8a84cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
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

0 comments on commit f8a84cf

Please sign in to comment.