diff options
author | Bert JW Regeer <xistence@0x58.com> | 2020-12-09 23:05:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 23:05:24 -0800 |
commit | 259230aa2b8b9cf675c996e157c5cf021c256059 (patch) | |
tree | cddc44ce36d490c2ca66185b3847bda8b7121e9b /tests/test_response.py | |
parent | 536df8686cc815f0e0ed22e6a7402b83dbec5a00 (diff) | |
parent | cbaa5fa864c0e8f15ba079124a4c42565601200c (diff) | |
download | webob-master.tar.gz |
Merge pull request #424 from d70-t/deflate_with_zlib_containermaster
deflate'd response: use RFC compliant decompression by default
Diffstat (limited to 'tests/test_response.py')
-rw-r--r-- | tests/test_response.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_response.py b/tests/test_response.py index 7f76bbe..ed2b7f1 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -425,6 +425,19 @@ def test_decode_content_with_deflate(): assert res.content_encoding is None +def test_decode_content_with_deflate_and_zlib_header(): + res = Response() + body = b"Hey Hey Hey" + # don't chop off the zlib container + # https://tools.ietf.org/html/rfc7230#section-4.2.2 says + # that chopping it exists but is non-conformant + res.body = zlib.compress(body) + res.content_encoding = "deflate" + res.decode_content() + assert res.body == body + assert res.content_encoding is None + + def test_content_length(): r0 = Response("x" * 10, content_length=10) |