summaryrefslogtreecommitdiff
path: root/tests/test_gzipper.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_gzipper.py')
-rw-r--r--tests/test_gzipper.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_gzipper.py b/tests/test_gzipper.py
index 54b7901..d56c406 100644
--- a/tests/test_gzipper.py
+++ b/tests/test_gzipper.py
@@ -4,8 +4,10 @@ import gzip
import six
def simple_app(environ, start_response):
- start_response('200 OK', [('content-type', 'text/plain')])
- return [b'this is a test']
+ start_response('200 OK',
+ [('content-type', 'text/plain'),
+ ('content-length', '0')])
+ return [b'this is a test'] if environ['REQUEST_METHOD'] != 'HEAD' else []
wsgi_app = middleware(simple_app)
app = TestApp(wsgi_app)
@@ -17,3 +19,9 @@ def test_gzip():
assert res.body != b'this is a test'
actual = gzip.GzipFile(fileobj=six.BytesIO(res.body)).read()
assert actual == b'this is a test'
+
+def test_gzip_head():
+ res = app.head(
+ '/', extra_environ=dict(HTTP_ACCEPT_ENCODING='gzip'))
+ assert int(res.header('content-length')) == 0
+ assert res.body == b''