wat_catcher 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wat_catcher/rack_middleware.rb +41 -6
- data/lib/wat_catcher/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37fe65800b08b5cacf90b14c7cef9a6f87faed48
|
4
|
+
data.tar.gz: 9fb0ad2584036e1ac4e8fef91619c84c5e914dff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dda3228fdfbe13d1f221fe68efb74b44487857d3ad5610a8a4eea9c256348532c4f3502461c4d12421cc9818f82e4b34207544518b0862d6481cdedde2e56e74
|
7
|
+
data.tar.gz: d0b8f1aec2f9dba2bf1f965665da80bf2af2a099927075cc83b3469a5af8f9a5efa714890ac7e9a3fbe4475ecf14cf7a99ef7e9a5f76b473fce32e0e6d89194f
|
@@ -1,5 +1,20 @@
|
|
1
1
|
module WatCatcher
|
2
2
|
class RackMiddleware
|
3
|
+
class WatCatcher::Request
|
4
|
+
attr_accessor :url, :method, :params, :headers, :session
|
5
|
+
|
6
|
+
def initialize(url, method, params, headers, session)
|
7
|
+
@url = url
|
8
|
+
@method = method
|
9
|
+
@params = params
|
10
|
+
@headers = headers
|
11
|
+
@session = session
|
12
|
+
end
|
13
|
+
|
14
|
+
def filtered_parameters
|
15
|
+
params
|
16
|
+
end
|
17
|
+
end
|
3
18
|
|
4
19
|
def initialize(app)
|
5
20
|
@app = app
|
@@ -9,13 +24,33 @@ module WatCatcher
|
|
9
24
|
@app.call(env)
|
10
25
|
rescue Exception => e
|
11
26
|
if !env["wat_report_disabled"]
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
27
|
+
begin
|
28
|
+
user, request = nil
|
29
|
+
if false && env["wat_report"]
|
30
|
+
user = env["wat_report"][:user]
|
31
|
+
request = env["wat_report"][:request]
|
32
|
+
else
|
33
|
+
rack_env = env
|
34
|
+
rack_request = ::Rack::Request.new(env)
|
35
|
+
params = rack_request.params rescue {}
|
36
|
+
|
37
|
+
# Build the clean url (hide the port if it is obvious)
|
38
|
+
url = "#{rack_request.scheme}://#{rack_request.host}"
|
39
|
+
url << ":#{rack_request.port}" unless [80, 443].include?(rack_request.port)
|
40
|
+
url << rack_request.fullpath
|
17
41
|
|
18
|
-
|
42
|
+
headers = {}
|
43
|
+
rack_env.each_pair do |key, value|
|
44
|
+
if key.to_s.start_with?("HTTP_") || ["CONTENT_TYPE", "CONTENT_LENGTH"].include?(key)
|
45
|
+
headers[key.upcase] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
request = WatCatcher::Request.new(url, rack_request.request_method, params.to_hash, headers, rack_env["rack.session"])
|
50
|
+
end
|
51
|
+
ensure
|
52
|
+
WatCatcher::Report.new(e, user: user, request: request)
|
53
|
+
end
|
19
54
|
end
|
20
55
|
raise
|
21
56
|
end
|
data/lib/wat_catcher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wat_catcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Constantine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -273,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
273
|
version: '0'
|
274
274
|
requirements: []
|
275
275
|
rubyforge_project:
|
276
|
-
rubygems_version: 2.
|
276
|
+
rubygems_version: 2.4.5
|
277
277
|
signing_key:
|
278
278
|
specification_version: 4
|
279
279
|
summary: A gem for registering Wats from your rails app
|