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 9571d06 commit 5712e57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/flask_debugtoolbar/__init__.py
Original file line number Diff line number Diff line change
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()
else:
response_html = response.get_data(as_text=True)
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 5712e57

Please sign in to comment.