rorvswild 1.0.0.pre.alpha4 → 1.0.0.pre.alpha5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rorvswild/plugin/action_controller.rb +17 -1
- data/lib/rorvswild/version.rb +1 -1
- data/test/plugin/action_controller_test.rb +8 -2
- 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: c6631971318d1ff790b7c9179f0766b029ce79cd
|
4
|
+
data.tar.gz: 0e2bfea436677d2367c5471cc6dbad4808f7231e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56736345c5a5c1f914051def41014701ce2a8bea7018a6fcc75644ed58c41063c03948199d95a8a623203c5930bb646393b63c22bc70f31b8abede040afd365e
|
7
|
+
data.tar.gz: c36a1093d301a008a70aa15292a29abea44aeae55dd9bd15c48f87c60424a86716a344628ea1724deedc09e3aa5deb26ba2b4783694bad38ea8eafb5b9c6686f
|
@@ -13,7 +13,8 @@ module RorVsWild
|
|
13
13
|
def self.after_exception(exception, controller)
|
14
14
|
if hash = RorVsWild.agent.push_exception(exception)
|
15
15
|
hash[:session] = controller.session.to_hash
|
16
|
-
hash[:
|
16
|
+
hash[:parameters] = controller.request.filtered_parameters
|
17
|
+
hash[:environment_variables] = extract_http_headers(controller.request.filtered_env)
|
17
18
|
end
|
18
19
|
raise exception
|
19
20
|
end
|
@@ -41,6 +42,21 @@ module RorVsWild
|
|
41
42
|
def finish(name, id, payload)
|
42
43
|
RorVsWild.agent.stop_request
|
43
44
|
end
|
45
|
+
|
46
|
+
def self.extract_http_headers(headers)
|
47
|
+
headers.reduce({}) do |hash, (name, value)|
|
48
|
+
if name.index("HTTP_".freeze) == 0 && name != "HTTP_COOKIE".freeze
|
49
|
+
hash[format_header_name(name)] = value
|
50
|
+
end
|
51
|
+
hash
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
HEADER_REGEX = /^HTTP_/.freeze
|
56
|
+
|
57
|
+
def self.format_header_name(name)
|
58
|
+
name.sub(HEADER_REGEX, ''.freeze).split("_".freeze).map(&:capitalize).join("-".freeze)
|
59
|
+
end
|
44
60
|
end
|
45
61
|
end
|
46
62
|
end
|
data/lib/rorvswild/version.rb
CHANGED
@@ -20,7 +20,8 @@ class RorVsWild::Plugin::ActionControllerTest < Minitest::Test
|
|
20
20
|
|
21
21
|
def test_callback_when_exception_is_raised
|
22
22
|
agent.expects(:post_request)
|
23
|
-
|
23
|
+
request = stub(filtered_parameters: {foo: "bar"}, filtered_env: {"HTTP_CONTENT_TYPE" => "HTML"})
|
24
|
+
controller = stub(session: {id: "session"}, request: request)
|
24
25
|
payload = {controller: "UsersController", action: "show"}
|
25
26
|
assert_raises(ZeroDivisionError) do
|
26
27
|
ActiveSupport::Notifications.instrument("process_action.action_controller", payload) do
|
@@ -36,7 +37,8 @@ class RorVsWild::Plugin::ActionControllerTest < Minitest::Test
|
|
36
37
|
assert_equal("UsersController#show", data[:name])
|
37
38
|
assert_equal("ZeroDivisionError", data[:error][:exception])
|
38
39
|
assert_equal({id: "session"}, data[:error][:session])
|
39
|
-
assert_equal({
|
40
|
+
assert_equal({foo: "bar"}, data[:error][:parameters])
|
41
|
+
assert_equal({"Content-Type" => "HTML"}, data[:error][:environment_variables])
|
40
42
|
end
|
41
43
|
|
42
44
|
class SampleController
|
@@ -54,5 +56,9 @@ class RorVsWild::Plugin::ActionControllerTest < Minitest::Test
|
|
54
56
|
assert_equal(__FILE__, agent.data[:sections][0].file)
|
55
57
|
assert_equal("RorVsWild::Plugin::ActionControllerTest::SampleController#index", agent.data[:sections][0].command)
|
56
58
|
end
|
59
|
+
|
60
|
+
def test_format_header_name
|
61
|
+
assert_equal("Content-Type", RorVsWild::Plugin::ActionController.format_header_name("HTTP_CONTENT_TYPE"))
|
62
|
+
end
|
57
63
|
end
|
58
64
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rorvswild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.alpha5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|