def inject_profiler(env,status,headers,body)
content_type = headers['Content-Type']
if config.disable_caching
headers.delete('ETag')
headers.delete('Date')
end
headers['Cache-Control'] = "#{"no-store, " if config.disable_caching}must-revalidate, private, max-age=0"
if headers.is_a? Hash
headers['X-MiniProfiler-Ids'] = ids_json(env)
end
if current.inject_js && content_type =~ /text\/html/
response = Rack::Response.new([], status, headers)
script = self.get_profile_script(env)
if String === body
response.write inject(body,script)
else
body.each { |fragment| response.write inject(fragment, script) }
end
body.close if body.respond_to? :close
response.finish
else
nil
end
end