lib/bullet/rack.rb in bullet-2.1.0 vs lib/bullet/rack.rb in bullet-2.2.0
- old
+ new
@@ -9,20 +9,20 @@
Bullet.start_request
status, headers, response = @app.call(env)
return [status, headers, response] if empty?(response)
+ response_body = nil
if Bullet.notification?
if status == 200 and !response.body.frozen? and check_html?(headers, response)
response_body = response.body << Bullet.gather_inline_notifications
headers['Content-Length'] = response_body.length.to_s
end
Bullet.perform_out_of_channel_notifications(env)
end
- response_body ||= response.body
Bullet.end_request
no_browser_cache(headers) if Bullet.disable_browser_cache
- [status, headers, [response_body]]
+ [status, headers, response_body ? [response_body] : response]
end
# fix issue if response's body is a Proc
def empty?(response)
# response may be ["Not Found"], ["Move Permanently"], etc.