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

Commit e0c9893

Browse files
committed
Failing test for response body decoding.
1 parent 3edb65c commit e0c9893

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_hyper.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
)
1414
from hyper.http20.response import HTTP20Response
1515
import pytest
16+
import zlib
1617
from io import BytesIO
1718

1819

@@ -1032,6 +1033,13 @@ def test_status_is_stripped_from_headers(self):
10321033
assert resp.status == 200
10331034
assert resp.getheaders() == []
10341035

1036+
def test_response_transparently_decrypts(self):
1037+
headers = {':status': '200', 'Content-Encoding': 'gzip'}
1038+
body = zlib.compress(b'this is test data')
1039+
resp = HTTP20Response(headers, DummyStream(body))
1040+
1041+
assert resp.read() == b'this is test data'
1042+
10351043

10361044
# Some utility classes for the tests.
10371045
class NullEncoder(object):
@@ -1048,3 +1056,10 @@ def send(self, data):
10481056

10491057
def recv(self, l):
10501058
return self.buffer.read(l)
1059+
1060+
class DummyStream(object):
1061+
def __init__(self, data):
1062+
self.data = data
1063+
1064+
def _read(self, *args, **kwargs):
1065+
return self.data

0 commit comments

Comments
 (0)