diff --git a/CHANGELOG.md b/CHANGELOG.md index 382cc73..8fadfa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 3.1.1 (16/01/2019): +Bugfix: + - Don't attempt to modify response unless JS api key is present + - Don't attempt to modify response unless it responds to indexing ([]) + - See PR ([#140](https://github.com/MindscapeHQ/raygun4ruby/pull/140)) + ## 3.1.0 (15/01/2019): Feature: diff --git a/lib/raygun/middleware/javascript_exception_tracking.rb b/lib/raygun/middleware/javascript_exception_tracking.rb index 3b416cc..4bbf987 100644 --- a/lib/raygun/middleware/javascript_exception_tracking.rb +++ b/lib/raygun/middleware/javascript_exception_tracking.rb @@ -16,8 +16,10 @@ def call(env) end def inject_javascript_to_response(response) - response[0].gsub!('', "#{js_tracker.head_html}") - response[0].gsub!('', "#{js_tracker.body_html}") + if Raygun.configuration.js_api_key.present? && response.respond_to?('[]') + response[0].gsub!('', "#{js_tracker.head_html}") + response[0].gsub!('', "#{js_tracker.body_html}") + end response end diff --git a/lib/raygun/version.rb b/lib/raygun/version.rb index 6b8b871..9575f28 100644 --- a/lib/raygun/version.rb +++ b/lib/raygun/version.rb @@ -1,3 +1,3 @@ module Raygun - VERSION = "3.1.0" + VERSION = "3.1.1" end