Skip to content

Commit

Permalink
No need to specify custom default value if key not found
Browse files Browse the repository at this point in the history
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 #154.
  • Loading branch information
jeffwidman committed Oct 13, 2023
1 parent 3b25e11 commit 2c71cb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/flask_debugtoolbar/__init__.py
Expand Up @@ -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(response.charset)
else:
response_html = response.data.decode(response.charset)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2c71cb7

Please sign in to comment.