Sha256: dbf15159048a1f36af7f30a64ecdfb457fff966b8d2a95d6b92da3b900e4362c
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
class Bulletware def initialize(app) @app = app end def call(env) return @app.call(env) unless Bullet.enable? Bullet.start_request status, headers, response = @app.call(env) return [status, headers, response] if response.empty? if Bullet.notification? if check_html?(headers, response) response_body = response.body << Bullet.javascript_notification headers['Content-Length'] = response_body.length.to_s end Bullet.growl_notification Bullet.log_notification(env['PATH_INFO']) end response_body ||= response.body Bullet.end_request no_browser_cache(headers) if Bullet.disable_browser_cache [status, headers, response_body] end def check_html?(headers, response) !headers['Content-Type'].nil? and headers['Content-Type'].include? 'text/html' and response.body =~ %r{<html.*</html>}m end def no_browser_cache(headers) headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" headers["Pragma"] = "no-cache" headers["Expires"] = "Wed, 09 Sep 2009 09:09:09 GMT" end end
Version data entries
5 entries across 5 versions & 1 rubygems