airbrake 6.1.1 → 6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/airbrake/logger.rb +1 -0
- data/lib/airbrake/rack/context_filter.rb +1 -0
- data/lib/airbrake/rack/user.rb +5 -1
- data/lib/airbrake/version.rb +1 -1
- data/spec/unit/rack/context_filter_spec.rb +22 -0
- data/spec/unit/rack/user_spec.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e691790e6c6e5e3fc0e48e508f65d25a8a51fb73
|
4
|
+
data.tar.gz: a92941a7772a033da11f09a5351bc38383034534
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52c5176e4e358427b5ebdc83d95a1a0811f06328ac41763b33f5095288f9c0d40b0405137c7b6b3e26934856d155ffcb087c8bc704f9cc4cfa52ca9e7460edec
|
7
|
+
data.tar.gz: fdc6d93eda79c5f9f5b4eb971582c1d88724fe6c812145949c87781813917d662087cccbbee58abfd04fe1a89315cb6ed87b40d8674c063eba453b265e24d0d6
|
data/lib/airbrake/logger.rb
CHANGED
data/lib/airbrake/rack/user.rb
CHANGED
@@ -50,7 +50,11 @@ module Airbrake
|
|
50
50
|
private
|
51
51
|
|
52
52
|
def try_to_get(key)
|
53
|
-
|
53
|
+
return unless @user.respond_to?(key)
|
54
|
+
# try methods with no arguments or with variable number of arguments,
|
55
|
+
# where none of them are required
|
56
|
+
return unless @user.method(key).arity.between?(-1, 0)
|
57
|
+
String(@user.__send__(key))
|
54
58
|
end
|
55
59
|
|
56
60
|
def full_name
|
data/lib/airbrake/version.rb
CHANGED
@@ -44,6 +44,28 @@ RSpec.describe Airbrake::Rack::ContextFilter do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
context "when visitor address is present" do
|
48
|
+
let(:opts) do
|
49
|
+
{ 'REMOTE_ADDR' => '1.2.3.4' }
|
50
|
+
end
|
51
|
+
|
52
|
+
it "adds userAddr to the context" do
|
53
|
+
subject.call(notice)
|
54
|
+
expect(notice[:context][:userAddr]).to eq('1.2.3.4')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when visitor is behind a proxy or load balancer" do
|
59
|
+
let(:opts) do
|
60
|
+
{ 'HTTP_X_FORWARDED_FOR' => '8.8.8.8, 9.9.9.9' }
|
61
|
+
end
|
62
|
+
|
63
|
+
it "adds userAddr to the context" do
|
64
|
+
subject.call(notice)
|
65
|
+
expect(notice[:context][:userAddr]).to eq('9.9.9.9')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
47
69
|
context "when controller is present" do
|
48
70
|
let(:controller) do
|
49
71
|
double.tap do |ctrl|
|
data/spec/unit/rack/user_spec.rb
CHANGED
@@ -189,5 +189,34 @@ RSpec.describe Airbrake::Rack::User do
|
|
189
189
|
expect(user_data).to be_empty
|
190
190
|
end
|
191
191
|
end
|
192
|
+
|
193
|
+
context "when Rack user's field expects a parameter" do
|
194
|
+
let(:user_data) do
|
195
|
+
described_class.new(
|
196
|
+
Class.new do
|
197
|
+
def name(required_param)
|
198
|
+
"my name is #{required_param}"
|
199
|
+
end
|
200
|
+
|
201
|
+
def id(required_param, *optional_params)
|
202
|
+
"id is #{required_param} #{optional_params.inspect}"
|
203
|
+
end
|
204
|
+
|
205
|
+
def username(*optional_params)
|
206
|
+
"username is #{optional_params.inspect}"
|
207
|
+
end
|
208
|
+
end.new
|
209
|
+
).as_json
|
210
|
+
end
|
211
|
+
|
212
|
+
it "does not call the method if it has required parameters" do
|
213
|
+
expect(user_data[:user]).not_to include(:id)
|
214
|
+
expect(user_data[:user]).not_to include(:name)
|
215
|
+
end
|
216
|
+
|
217
|
+
it "calls the method if it has a variable number of optional parameters" do
|
218
|
+
expect(user_data[:user]).to include(:username)
|
219
|
+
end
|
220
|
+
end
|
192
221
|
end
|
193
222
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake-ruby
|