lib/bullet/rack.rb in bullet-5.7.6 vs lib/bullet/rack.rb in bullet-5.8.0
- old
+ new
@@ -8,10 +8,11 @@
@app = app
end
def call(env)
return @app.call(env) unless Bullet.enable?
+
Bullet.start_request
status, headers, response = @app.call(env)
response_body = nil
if Bullet.notification?
@@ -64,11 +65,11 @@
def sse?(headers)
headers['Content-Type'] == 'text/event-stream'
end
def html_request?(headers, response)
- headers['Content-Type'] && headers['Content-Type'].include?('text/html') && response_body(response).include?('<html')
+ headers['Content-Type']&.include?('text/html') && response_body(response).include?('<html')
end
def response_body(response)
if response.respond_to?(:body)
Array === response.body ? response.body.first : response.body
@@ -78,16 +79,16 @@
end
private
def footer_div_attributes
- <<EOF
-data-is-bullet-footer ondblclick="this.parentNode.removeChild(this);" style="position: fixed; bottom: 0pt; left: 0pt; cursor: pointer; border-style: solid; border-color: rgb(153, 153, 153);
- -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none;
- -moz-border-left-colors: none; -moz-border-image: none; border-width: 2pt 2pt 0px 0px;
- padding: 3px 5px; border-radius: 0pt 10pt 0pt 0px; background: none repeat scroll 0% 0% rgba(200, 200, 200, 0.8);
- color: rgb(119, 119, 119); font-size: 16px; font-family: 'Arial', sans-serif; z-index:9999;"
-EOF
+ <<~EOF
+ data-is-bullet-footer ondblclick="this.parentNode.removeChild(this);" style="position: fixed; bottom: 0pt; left: 0pt; cursor: pointer; border-style: solid; border-color: rgb(153, 153, 153);
+ -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none;
+ -moz-border-left-colors: none; -moz-border-image: none; border-width: 2pt 2pt 0px 0px;
+ padding: 3px 5px; border-radius: 0pt 10pt 0pt 0px; background: none repeat scroll 0% 0% rgba(200, 200, 200, 0.8);
+ color: rgb(119, 119, 119); font-size: 16px; font-family: 'Arial', sans-serif; z-index:9999;"
+ EOF
end
def footer_close_button
"<span onclick='this.parentNode.remove()' style='position:absolute; right: 10px; top: 0px; font-weight: bold; color: #333;'>×</span>"
end