rack-exception_notifier 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -4
- data/lib/rack/exception_notifier.rb +13 -2
- data/lib/rack/exception_notifier/version.rb +1 -1
- data/spec/lib/rack/exception_notifier_spec.rb +2 -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: af68cee5a1ae828ca8d935a675800f38e13be954
|
4
|
+
data.tar.gz: 099cd9b3e73574cb4c0e0d28498aa7468e3ff14a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d009be9296b8a13ee7c40ef78257ac9f52e338a020ac9b4160ef862824560e440bf70a5b3d7f556dbdd6be99385e5b9c52bb114cbbb32fe2c17d015ad38736
|
7
|
+
data.tar.gz: 4a848d2870470ae92d7d6ab8c5192e0a1fe6b5158e2bae2459c10acbbacf1854d4b834aa9f969c761ffaf0593b561703fc708820b651818815c23a69710ca1a9
|
data/README.md
CHANGED
@@ -28,7 +28,3 @@ use Rack::ExceptionNotifier,
|
|
28
28
|
* `:from` - address to originate email exceptions from (default: running username)
|
29
29
|
* `:subject` - subject line for emails, %s will be interpolated with the exception #to_s (default: [ERROR] %s)
|
30
30
|
* `:include_body` - should the body of the request be included in the email (default: false)
|
31
|
-
|
32
|
-
## License
|
33
|
-
|
34
|
-
Rack-exception_notifier is released under the [MIT license](http://www.opensource.org/licenses/MIT).
|
@@ -3,6 +3,8 @@ require 'mail'
|
|
3
3
|
|
4
4
|
module Rack
|
5
5
|
class ExceptionNotifier
|
6
|
+
ExcludeBodyKeys = %w[rack.input rack.request.form_hash rack.request.form_input rack.request.form_vars]
|
7
|
+
|
6
8
|
def initialize(app, options)
|
7
9
|
default_options = {
|
8
10
|
:to => nil,
|
@@ -40,6 +42,14 @@ module Rack
|
|
40
42
|
env['rack.input'].size > 0
|
41
43
|
end
|
42
44
|
|
45
|
+
def _exclude_env_key?(env, key)
|
46
|
+
if _render_body?(env)
|
47
|
+
false
|
48
|
+
else
|
49
|
+
ExcludeBodyKeys.include?(key)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
43
53
|
def _render_body?(env)
|
44
54
|
_body_present?(env) && @options[:include_body]
|
45
55
|
end
|
@@ -69,8 +79,9 @@ module Rack
|
|
69
79
|
PWD: <%= Dir.getwd %>
|
70
80
|
|
71
81
|
<%= env.to_a.
|
72
|
-
|
73
|
-
|
82
|
+
reject { |key, value| _exclude_env_key?(env, key) }.
|
83
|
+
sort { |a, b| a.first <=> b.first }.
|
84
|
+
map{ |key, value| "%-25s%p" % [key + ':', value] }.
|
74
85
|
join("\n ") %>
|
75
86
|
|
76
87
|
<% if exception.respond_to?(:backtrace) %>
|
@@ -65,6 +65,8 @@ describe Rack::ExceptionNotifier do
|
|
65
65
|
|
66
66
|
mail = Mail::TestMailer.deliveries.first
|
67
67
|
mail.body.raw_source.should_not include('Request Body')
|
68
|
+
mail.body.raw_source.should_not include('rack.input')
|
69
|
+
mail.body.raw_source.should_not include('rack.request.form_')
|
68
70
|
end
|
69
71
|
|
70
72
|
it 'includes the body if configured' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-exception_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Downey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|