rollbar 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -2
- data/CHANGELOG.md +5 -1
- data/lib/rollbar.rb +2 -1
- data/lib/rollbar/request_data_extractor.rb +12 -18
- data/lib/rollbar/version.rb +1 -1
- data/spec/controllers/home_controller_spec.rb +15 -2
- data/spec/dummyapp/config/routes.rb +1 -1
- data/spec/requests/home_spec.rb +10 -7
- metadata +2 -2
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
**0.10.
|
3
|
+
**0.10.3**
|
4
|
+
- Rework how request params are extracted so that json params are properly extracted in rails 4.0
|
5
|
+
- Fix rollbar:test rake task
|
6
|
+
|
7
|
+
**0.10.2**
|
4
8
|
- Require hooks at configuration time instead of gem load time
|
5
9
|
|
6
10
|
**0.10.1**
|
data/lib/rollbar.rb
CHANGED
@@ -12,6 +12,8 @@ require 'rollbar/configuration'
|
|
12
12
|
require 'rollbar/request_data_extractor'
|
13
13
|
require 'rollbar/exception_reporter'
|
14
14
|
|
15
|
+
require 'rollbar/railtie' if defined?(Rails)
|
16
|
+
|
15
17
|
module Rollbar
|
16
18
|
class << self
|
17
19
|
attr_writer :configuration
|
@@ -146,7 +148,6 @@ module Rollbar
|
|
146
148
|
require 'rollbar/goalie' if defined?(Goalie)
|
147
149
|
require 'rollbar/rack' if defined?(Rack)
|
148
150
|
require 'rollbar/rake' if defined?(Rake)
|
149
|
-
require 'rollbar/railtie' if defined?(Rails)
|
150
151
|
require 'rollbar/better_errors' if defined?(BetterErrors)
|
151
152
|
end
|
152
153
|
|
@@ -14,19 +14,13 @@ module Rollbar
|
|
14
14
|
rack_req = Rack::Request.new(env)
|
15
15
|
|
16
16
|
sensitive_params = sensitive_params_list(env)
|
17
|
-
request_params = rollbar_request_params(env)
|
17
|
+
request_params = rollbar_filtered_params(sensitive_params, rollbar_request_params(env))
|
18
18
|
get_params = rollbar_filtered_params(sensitive_params, rollbar_get_params(rack_req))
|
19
19
|
post_params = rollbar_filtered_params(sensitive_params, rollbar_post_params(rack_req))
|
20
20
|
cookies = rollbar_filtered_params(sensitive_params, rollbar_request_cookies(rack_req))
|
21
21
|
session = rollbar_filtered_params(sensitive_params, env['rack.session.options'])
|
22
22
|
|
23
|
-
params =
|
24
|
-
|
25
|
-
# parse any json params
|
26
|
-
if env['CONTENT_TYPE'] =~ %r{application/json}i
|
27
|
-
json_params = JSON.parse(env['rack.input'].read) rescue {}
|
28
|
-
params = params.merge(json_params)
|
29
|
-
end
|
23
|
+
params = request_params.merge(get_params).merge(post_params)
|
30
24
|
|
31
25
|
{
|
32
26
|
:params => params,
|
@@ -66,16 +60,7 @@ module Rollbar
|
|
66
60
|
def rollbar_user_ip(env)
|
67
61
|
(env['action_dispatch.remote_ip'] || env['HTTP_X_REAL_IP'] || env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR']).to_s
|
68
62
|
end
|
69
|
-
|
70
|
-
def rollbar_request_params(env)
|
71
|
-
route = ::Rails.application.routes.recognize_path(env['PATH_INFO']) rescue {}
|
72
|
-
{
|
73
|
-
:controller => route[:controller],
|
74
|
-
:action => route[:action],
|
75
|
-
:format => route[:format],
|
76
|
-
}
|
77
|
-
end
|
78
|
-
|
63
|
+
|
79
64
|
def rollbar_get_params(rack_req)
|
80
65
|
rack_req.GET
|
81
66
|
rescue
|
@@ -87,6 +72,15 @@ module Rollbar
|
|
87
72
|
rescue
|
88
73
|
{}
|
89
74
|
end
|
75
|
+
|
76
|
+
def rollbar_request_params(env)
|
77
|
+
route = ::Rails.application.routes.recognize_path(env['PATH_INFO']) rescue {}
|
78
|
+
{
|
79
|
+
:controller => route[:controller],
|
80
|
+
:action => route[:action],
|
81
|
+
:format => route[:format],
|
82
|
+
}.merge(env['action_dispatch.request.parameters'] || {})
|
83
|
+
end
|
90
84
|
|
91
85
|
def rollbar_request_cookies(rack_req)
|
92
86
|
rack_req.cookies
|
data/lib/rollbar/version.rb
CHANGED
@@ -196,6 +196,7 @@ describe HomeController do
|
|
196
196
|
|
197
197
|
it "should raise a NameError and have JSON POST params" do
|
198
198
|
logger_mock.should_receive(:info).with('[Rollbar] Success')
|
199
|
+
@request.env["HTTP_ACCEPT"] = "application/json"
|
199
200
|
|
200
201
|
params = {:jsonparam => 'jsonval'}.to_json
|
201
202
|
post 'report_exception', params, {'CONTENT_TYPE' => 'application/json'}
|
@@ -214,11 +215,23 @@ describe HomeController do
|
|
214
215
|
|
215
216
|
context 'show_exceptions' do
|
216
217
|
before(:each) do
|
217
|
-
Dummy::Application.env_config
|
218
|
+
if Dummy::Application.respond_to? :env_config
|
219
|
+
config = Dummy::Application.env_config
|
220
|
+
else
|
221
|
+
config = Dummy::Application.env_defaults
|
222
|
+
end
|
223
|
+
|
224
|
+
config['action_dispatch.show_exceptions'] = true
|
218
225
|
end
|
219
226
|
|
220
227
|
after(:each) do
|
221
|
-
Dummy::Application.env_config
|
228
|
+
if Dummy::Application.respond_to? :env_config
|
229
|
+
config = Dummy::Application.env_config
|
230
|
+
else
|
231
|
+
config = Dummy::Application.env_defaults
|
232
|
+
end
|
233
|
+
|
234
|
+
config['action_dispatch.show_exceptions'] = false
|
222
235
|
end
|
223
236
|
|
224
237
|
it "middleware should catch the exception and only report to rollbar once" do
|
@@ -5,6 +5,6 @@ Dummy::Application.routes.draw do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
get "/cause_exception" => "home#cause_exception"
|
8
|
-
match "/report_exception" => "home#report_exception", :via=> [:get, :
|
8
|
+
match "/report_exception" => "home#report_exception", :via => [:get, :post, :put]
|
9
9
|
get "/current_user" => "home#current_user"
|
10
10
|
end
|
data/spec/requests/home_spec.rb
CHANGED
@@ -16,13 +16,16 @@ describe HomeController do
|
|
16
16
|
|
17
17
|
context "with broken request" do
|
18
18
|
it "should report uncaught exceptions" do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
# only seems to be relevant in 3.1 and 3.2
|
20
|
+
if ::Rails::VERSION::STRING.starts_with? "3.1" or ::Rails::VERSION::STRING.starts_with? "3.2"
|
21
|
+
expect{ get 'current_user', nil, :cookie => '8%B' }.to raise_exception
|
22
|
+
|
23
|
+
Rollbar.last_report.should_not be_nil
|
24
|
+
|
25
|
+
exception_info = Rollbar.last_report[:body][:trace][:exception]
|
26
|
+
exception_info[:class].should == 'ArgumentError'
|
27
|
+
exception_info[:message].should == 'invalid %-encoding (8%B)'
|
28
|
+
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|