From 3292aff531d4dee5cf30a003d5d2ee745f718f86 Mon Sep 17 00:00:00 2001 From: Andre LeBlanc Date: Tue, 12 Apr 2011 16:32:40 -0400 Subject: Fixed KeyError when content-type is not set on an HttpResponse --- debug_toolbar/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index de78254..0931389 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -99,7 +99,7 @@ class DebugToolbarMiddleware(object): if response.status_code == 200: for panel in self.debug_toolbars[request].panels: panel.process_response(request, response) - if response['Content-Type'].split(';')[0] in _HTML_TYPES: + if response.get('Content-Type', None) and response['Content-Type'].split(';')[0] in _HTML_TYPES: response.content = replace_insensitive( smart_unicode(response.content), self.tag, -- cgit v1.2.3