diff --git a/flask_debugtoolbar/__init__.py b/flask_debugtoolbar/__init__.py index 17aa860..84fd421 100644 --- a/flask_debugtoolbar/__init__.py +++ b/flask_debugtoolbar/__init__.py @@ -170,16 +170,16 @@ class DebugToolbarExtension(object): if response.is_sequence: response_html = response.data.decode(response.charset) - if "" in response_html: - toolbar_html = self.debug_toolbars[real_request].render_toolbar() + toolbar_html = self.debug_toolbars[real_request].render_toolbar() - content = replace_insensitive( - response_html, '', toolbar_html + '') + content = replace_insensitive( + response_html, '', toolbar_html + '') + if content is response_html: + warnings.warn('Could not insert debug toolbar. tag not found in response.') + else: content = content.encode(response.charset) response.response = [content] response.content_length = len(content) - else: - warnings.warn("Could not insert debug toolbar. element not found in response.") return response