request_recorder 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dc4d2b67c8b0601ef0380fc69a563a50d2421bdd
4
+ data.tar.gz: bc96e751bbb9564c4412269e873b041beb40d550
5
+ SHA512:
6
+ metadata.gz: b888a4bb428565bb823619d09bde02f0e3bdb22892fc917420f1fa0f6d08720308c80167bcd7cf877c6b8775602244364e4761592c8f31e40b1290028ba11094
7
+ data.tar.gz: e4073afefb41427dfc5628fa6c4294a2fd25a6fb1b631757485aea875e79bb76b677005e62d86fedc51fb4fa576729b1dd98c6b724d2930be94a63dc0ab75146
@@ -1,3 +1,4 @@
1
+ bundler_args: ""
1
2
  rvm:
2
3
  - ree
3
4
  - 1.9.2
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ gem "rack", ">= 1.5.2"
10
10
  gem "sqlite3"
11
11
  gem "fakeredis"
12
12
  gem "json"
13
+ gem "logcast", "0.1.4" # TODO update, works with newer version in production but tests break :/
14
+ gem "iconv"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- request_recorder (0.3.2)
4
+ request_recorder (0.3.3)
5
5
  activerecord
6
6
  logcast (>= 0.1.4)
7
7
  multi_json
@@ -31,6 +31,7 @@ GEM
31
31
  fakeredis (0.4.2)
32
32
  redis (~> 3.0.0)
33
33
  i18n (0.6.1)
34
+ iconv (1.0.4)
34
35
  json (1.7.7)
35
36
  logcast (0.1.4)
36
37
  multi_json (1.7.2)
@@ -56,7 +57,9 @@ DEPENDENCIES
56
57
  appraisal
57
58
  bump
58
59
  fakeredis
60
+ iconv
59
61
  json
62
+ logcast (= 0.1.4)
60
63
  rack (>= 1.5.2)
61
64
  rake
62
65
  request_recorder!
data/Readme.md CHANGED
@@ -7,14 +7,16 @@ Install
7
7
 
8
8
  Add to your middleware stack:
9
9
 
10
- require "request_recorder"
11
-
12
- require "request_recorder/cache_logger"
13
- use RequestRecorder::Middleware,
14
- :store => RequestRecorder::CacheLogger.new(Rails.cache),
15
- :frontend_auth => lambda { |env| Rails.env.development? } # TODO use something like `env.warden.user.is_admin?` in production, or return a [status, headers, body] array for custom failure message
16
- # if you get 502's because of too large headers, you can reduce them: everything in :remove will be removed when above :max
17
- # :headers => {:max => 10_000, :remove => [/Identity Map/, /Cache local read/, /Cache read/, /SELECT count(\*)/, /SELECT \* FROM/] }
10
+ ```Ruby
11
+ require "request_recorder"
12
+
13
+ require "request_recorder/cache_logger"
14
+ use RequestRecorder::Middleware,
15
+ :store => RequestRecorder::CacheLogger.new(Rails.cache),
16
+ :frontend_auth => lambda { |env| Rails.env.development? } # TODO use something like `env.warden.user.is_admin?` in production, or return a [status, headers, body] array for custom failure message
17
+ # if you get 502's because of too large headers, you can reduce them: everything in :remove will be removed when above :max
18
+ # :headers => {:max => 10_000, :remove => [/Identity Map/, /Cache local read/, /Cache read/, /SELECT count(\*)/, /SELECT \* FROM/] }
19
+ ```
18
20
 
19
21
  Usage
20
22
  =====
@@ -9,6 +9,8 @@ gem "rspec", "~>2"
9
9
  gem "sqlite3"
10
10
  gem "fakeredis"
11
11
  gem "json"
12
+ gem "logcast", "0.1.4"
13
+ gem "iconv"
12
14
  gem "rack", "~> 1.1.6"
13
15
  gem "activerecord", "~>2.3.14"
14
16
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /Users/mgrosser/code/tools/request_recorder
2
+ remote: ../
3
3
  specs:
4
- request_recorder (0.3.1)
4
+ request_recorder (0.3.2)
5
5
  activerecord
6
6
  logcast (>= 0.1.4)
7
7
  multi_json
@@ -20,9 +20,10 @@ GEM
20
20
  diff-lcs (1.2.3)
21
21
  fakeredis (0.4.2)
22
22
  redis (~> 3.0.0)
23
+ iconv (1.0.4)
23
24
  json (1.7.7)
24
25
  logcast (0.1.4)
25
- multi_json (1.7.3)
26
+ multi_json (1.8.4)
26
27
  rack (1.1.6)
27
28
  rake (10.0.4)
28
29
  redis (3.0.3)
@@ -44,7 +45,9 @@ DEPENDENCIES
44
45
  appraisal
45
46
  bump
46
47
  fakeredis
48
+ iconv
47
49
  json
50
+ logcast (= 0.1.4)
48
51
  rack (~> 1.1.6)
49
52
  rake
50
53
  request_recorder!
@@ -11,5 +11,7 @@ gem "rack", ">= 1.5.2"
11
11
  gem "sqlite3"
12
12
  gem "fakeredis"
13
13
  gem "json"
14
+ gem "logcast", "0.1.4"
15
+ gem "iconv"
14
16
 
15
17
  gemspec :path=>"../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /Users/mgrosser/code/tools/request_recorder
2
+ remote: ../
3
3
  specs:
4
- request_recorder (0.3.1)
4
+ request_recorder (0.3.2)
5
5
  activerecord
6
6
  logcast (>= 0.1.4)
7
7
  multi_json
@@ -31,6 +31,7 @@ GEM
31
31
  fakeredis (0.4.2)
32
32
  redis (~> 3.0.0)
33
33
  i18n (0.6.1)
34
+ iconv (1.0.4)
34
35
  json (1.7.7)
35
36
  logcast (0.1.4)
36
37
  multi_json (1.7.2)
@@ -56,7 +57,9 @@ DEPENDENCIES
56
57
  appraisal
57
58
  bump
58
59
  fakeredis
60
+ iconv
59
61
  json
62
+ logcast (= 0.1.4)
60
63
  rack (>= 1.5.2)
61
64
  rake
62
65
  request_recorder!
@@ -41,7 +41,7 @@ module RequestRecorder
41
41
  end
42
42
 
43
43
  steps_left, id = read_state_from_env(env)
44
- return [500, {}, "#{MARKER} exceeded maximum value #{MAX_STEPS}"] if steps_left > MAX_STEPS
44
+ return [500, {}, ["#{MARKER} exceeded maximum value #{MAX_STEPS}"]] if steps_left > MAX_STEPS
45
45
  id = persist_log(id, log)
46
46
 
47
47
  if result.is_a?(Exception)
@@ -65,16 +65,16 @@ module RequestRecorder
65
65
  response
66
66
  else
67
67
  if log = @store.read(key)
68
- [200, {}, Frontend.render(log)]
68
+ [200, {}, [Frontend.render(log)]]
69
69
  else
70
- [404, {}, "Did not find a log for key #{key}"]
70
+ [404, {}, ["Did not find a log for key #{key}"]]
71
71
  end
72
72
  end
73
73
  else
74
- [401, {}, "Unauthorized"]
74
+ [401, {}, ["Unauthorized"]]
75
75
  end
76
76
  else
77
- [500, {}, "you need to provide #{AUTH.inspect} option"]
77
+ [500, {}, ["you need to provide #{AUTH.inspect} option"]]
78
78
  end
79
79
  end
80
80
 
@@ -1,3 +1,3 @@
1
1
  module RequestRecorder
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -57,7 +57,7 @@ describe RequestRecorder do
57
57
  it "blows up if you go over the maximum" do
58
58
  status, headers, body = middleware.call("QUERY_STRING" => "request_recorder=99999")
59
59
  status.should == 500
60
- body.should include "maximum"
60
+ body.to_s.should include "maximum"
61
61
  end
62
62
 
63
63
  context "subsequent requests" do
@@ -139,7 +139,7 @@ describe RequestRecorder do
139
139
  it "can view a log" do
140
140
  status, headers, body = middleware.call("PATH_INFO" => "/request_recorder/xxx", "success" => true)
141
141
  status.should == 200
142
- body.should include("yyy")
142
+ body.to_s.should include("yyy")
143
143
  end
144
144
 
145
145
  it "cannot view a log if auth fails" do
@@ -151,20 +151,20 @@ describe RequestRecorder do
151
151
  it "returns custom auth failure response" do
152
152
  status, headers, body = middleware.call("PATH_INFO" => "/request_recorder/xxx", "success" => [422, {}, "Barfoo"])
153
153
  status.should == 422
154
- body.should include("Barfoo")
154
+ body.to_s.should include("Barfoo")
155
155
  end
156
156
 
157
157
  it "cannot view a missing log" do
158
158
  status, headers, body = middleware.call("PATH_INFO" => "/request_recorder/missing-key", "success" => true)
159
159
  status.should == 404
160
- body.should include("missing-key")
160
+ body.to_s.should include("missing-key")
161
161
  end
162
162
 
163
163
  it "warns about unconfigured :frontend_auth" do
164
164
  middleware = RequestRecorder::Middleware.new(inner_app, :store => store, :max_header_size => 1000)
165
165
  status, headers, body = middleware.call("PATH_INFO" => "/request_recorder/xxx")
166
166
  status.should == 500
167
- body.should include(":frontend_auth")
167
+ body.to_s.should include(":frontend_auth")
168
168
  end
169
169
 
170
170
  context "chrome logger" do
@@ -1,6 +1,7 @@
1
1
  require "active_record"
2
2
  require "fakeredis"
3
3
  require "tempfile"
4
+ require "active_support/all"
4
5
 
5
6
  ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new("/dev/null")
6
7
 
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request_recorder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
5
- prerelease:
4
+ version: 0.3.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michael Grosser
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rack
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: multi_json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: activerecord
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: logcast
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: 0.1.4
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: 0.1.4
78
69
  description:
@@ -107,32 +98,25 @@ files:
107
98
  homepage: http://github.com/grosser/request_recorder
108
99
  licenses:
109
100
  - MIT
101
+ metadata: {}
110
102
  post_install_message:
111
103
  rdoc_options: []
112
104
  require_paths:
113
105
  - lib
114
106
  required_ruby_version: !ruby/object:Gem::Requirement
115
- none: false
116
107
  requirements:
117
- - - ! '>='
108
+ - - '>='
118
109
  - !ruby/object:Gem::Version
119
110
  version: '0'
120
- segments:
121
- - 0
122
- hash: 1818230885787774460
123
111
  required_rubygems_version: !ruby/object:Gem::Requirement
124
- none: false
125
112
  requirements:
126
- - - ! '>='
113
+ - - '>='
127
114
  - !ruby/object:Gem::Version
128
115
  version: '0'
129
- segments:
130
- - 0
131
- hash: 1818230885787774460
132
116
  requirements: []
133
117
  rubyforge_project:
134
- rubygems_version: 1.8.25
118
+ rubygems_version: 2.0.14
135
119
  signing_key:
136
- specification_version: 3
120
+ specification_version: 4
137
121
  summary: Record your rack/rails requests and store them for future inspection
138
122
  test_files: []