From 5712e578699810f89b385de70a2342860945220f Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Fri, 13 Oct 2023 06:23:09 -0700 Subject: [PATCH] No need to specify custom default value if key not found The `''` arg specifies a custom default value if the key isn't found. However, the default of `None` works fine for boolean testing: ```python >>> 'gzip' in [None] False ``` I missed this when I originally reviewed https://github.com/pallets-eco/flask-debugtoolbar/pull/154. --- src/flask_debugtoolbar/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flask_debugtoolbar/__init__.py b/src/flask_debugtoolbar/__init__.py index f02994d..9c59cf5 100644 --- a/src/flask_debugtoolbar/__init__.py +++ b/src/flask_debugtoolbar/__init__.py @@ -230,7 +230,7 @@ def process_response(self, response): response.headers['content-type'].startswith('text/html')): return response - if 'gzip' in response.headers.get('Content-Encoding', ''): + if 'gzip' in response.headers.get('Content-Encoding'): response_html = gzip_decompress(response.data).decode() else: response_html = response.get_data(as_text=True) @@ -258,7 +258,7 @@ def process_response(self, response): content = ''.join((before, toolbar_html, after)) content = content.encode(response.charset) - if 'gzip' in response.headers.get('Content-Encoding', ''): + if 'gzip' in response.headers.get('Content-Encoding'): content = gzip_compress(content) response.response = [content] response.content_length = len(content)