diff --git a/lib/load_speed.rb b/lib/load_speed.rb index c36b5c5..6930241 100644 --- a/lib/load_speed.rb +++ b/lib/load_speed.rb @@ -14,7 +14,10 @@ def call(env) index = body.rindex("</body>") if index body.insert(index, performance_code) - headers["Content-Length"] = body.length.to_s + # + # handle body w/ UTF8 characters for Ruby 1.9+ to avoid Rack::Lint::LintError + # + headers["Content-Length"] = (body.respond_to?(:bytesize) ? body.bytesize : body.length).to_s response = [body] end end