Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ public/debugbar.js

package-lock.json
Gemfile.lock
.DS_Store
11 changes: 9 additions & 2 deletions lib/debugbar/middlewares/track_current_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ def call(env)
RequestBuffer.push(Debugbar::Current.pop_request!)

# TODO: Refactor since not having ActionCable might be more common than I thought
if defined?(ActionCable)
ActionCable.server.broadcast("debugbar_channel", RequestBuffer.to_h)
payload = RequestBuffer.to_h

# Validate JSON-encodability before broadcast; skip if it would crash
begin
ActiveSupport::JSON.encode(payload) # will raise on invalid UTF-8
ActionCable.server.broadcast("debugbar_channel", payload)
rescue JSON::GeneratorError
# Non-text/binary snuck into the payload (e.g. .xkt). Skip live update.
# (Everything else — header, request logging, X-Debugbar-Url — still works.)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/debugbar/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Debugbar
VERSION = "0.4.3"
VERSION = "0.4.4"
end