lib/rorvswild/local/middleware.rb in rorvswild-1.3.4 vs lib/rorvswild/local/middleware.rb in rorvswild-1.3.5
- old
+ new
@@ -30,17 +30,22 @@
end
[status, headers, body]
end
def inject_into(html)
+ markup = html_markup(RorVsWild.agent.queue.requests).encode(html.encoding)
+ style = "<style type='text/css'> #{concatenate_stylesheet}</style>".encode(html.encoding)
+
if index = html.index("</body>")
- html.insert(index, html_markup(RorVsWild.agent.queue.requests))
+ html.insert(index, markup)
end
if index = html.index("</head>")
- html.insert(index, "<style type='text/css'> #{concatenate_stylesheet}</style>")
+ html.insert(index, style)
end
html
+ rescue Encoding::UndefinedConversionError => ex
+ log_incompatible_encoding_warning(ex)
end
LOCAL_FOLDER = File.expand_path(File.dirname(__FILE__))
JS_FOLDER = File.join(LOCAL_FOLDER, "javascript")
CSS_FOLDER = File.join(LOCAL_FOLDER, "stylesheet")
@@ -66,9 +71,14 @@
def log_incompatible_middleware_warning
RorVsWild.logger.warn("RorVsWild::Local cannot be embeded into your HTML page because of compression." +
" Try to disable Rack::Deflater in development only." +
" In the meantime just visit the /rorvswild page to see the profiler.")
+ end
+
+ def log_incompatible_encoding_warning(exception)
+ RorVsWild.logger.warn("RorVsWild::Local cannot be embeded into your HTML page because of incompatible #{exception.message}." +
+ " However you can just visit the /rorvswild page to see the profiler.")
end
end
end
end