From 528a7dfc839f6b0b1c33cb4534bae84dd1ec04a2 Mon Sep 17 00:00:00 2001 From: Matt Good Date: Mon, 19 Dec 2011 15:55:44 -0800 Subject: [PATCH] Only process html responses It tried to modify all responses, which added junk to the end of non-html pages, and would cause errors trying to decode images as utf8. --- flask_debugtoolbar/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flask_debugtoolbar/__init__.py b/flask_debugtoolbar/__init__.py index c0251ac..9e0a670 100644 --- a/flask_debugtoolbar/__init__.py +++ b/flask_debugtoolbar/__init__.py @@ -116,7 +116,8 @@ class DebugToolbarExtension(object): # If the http response code is 200 then we process to add the # toolbar to the returned html response. - if response.status_code == 200: + if (response.status_code == 200 + and response.headers['content-type'].startswith('text/html')): for panel in self.debug_toolbars[real_request].panels: panel.process_response(real_request, response)