Skip to content

Commit e70b43b

Browse files
Merge pull request #4 from debfx/fix-error-empty-response
Fix error when the response has no content-type
2 parents 5a7e195 + 795ac7b commit e70b43b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drf_api_logger/middleware/api_logger_middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __call__(self, request):
8181

8282
headers = get_headers(request=request)
8383
method = request.method
84-
if response['content-type'] == 'application/json':
84+
if 'content-type' in response and response['content-type'] == 'application/json':
8585
if getattr(response, 'streaming', False):
8686
response_body = '** Streaming **'
8787
else:

0 commit comments

Comments
 (0)