httplog 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +14 -0
- data/CHANGELOG.md +75 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +124 -0
- data/Guardfile +24 -0
- data/README.md +5 -6
- data/gemfiles/http2.gemfile +5 -0
- data/gemfiles/http3.gemfile +5 -0
- data/gemfiles/http4.gemfile +5 -0
- data/httplog.gemspec +41 -0
- data/lib/httplog/adapters/http.rb +9 -1
- data/lib/httplog/version.rb +1 -1
- data/spec/adapters/ethon_adapter.rb +24 -0
- data/spec/adapters/excon_adapter.rb +14 -0
- data/spec/adapters/faraday_adapter.rb +53 -0
- data/spec/adapters/http_adapter.rb +25 -0
- data/spec/adapters/http_base_adapter.rb +31 -0
- data/spec/adapters/httparty_adapter.rb +14 -0
- data/spec/adapters/httpclient_adapter.rb +25 -0
- data/spec/adapters/net_http_adapter.rb +19 -0
- data/spec/adapters/open_uri_adapter.rb +17 -0
- data/spec/adapters/patron_adapter.rb +34 -0
- data/spec/adapters/typhoeus_adapter.rb +27 -0
- data/spec/configuration_spec.rb +23 -0
- data/spec/http_log_spec.rb +358 -0
- data/spec/log/.gitkeep +0 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/index.html +8 -0
- data/spec/support/index.html.gz +0 -0
- data/spec/support/log4r.yml +17 -0
- data/spec/support/test.bin +0 -0
- data/spec/support/test_server.rb +31 -0
- data/spec/support/utf8-invalid.html +0 -0
- data/spec/support/utf8.html +8 -0
- metadata +99 -64
data/spec/log/.gitkeep
ADDED
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$:.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'httpclient'
|
5
|
+
require 'excon'
|
6
|
+
# require 'typhoeus'
|
7
|
+
require 'ethon'
|
8
|
+
require 'patron'
|
9
|
+
require 'http'
|
10
|
+
require 'simplecov'
|
11
|
+
|
12
|
+
SimpleCov.start
|
13
|
+
|
14
|
+
require 'httplog'
|
15
|
+
|
16
|
+
require 'adapters/http_base_adapter'
|
17
|
+
Dir[File.dirname(__FILE__) + '/adapters/*.rb'].each { |f| require f }
|
18
|
+
Dir["./spec/support/**/*.rb"].each {|f| require f}
|
19
|
+
|
20
|
+
# Start a local rack server to serve up test pages.
|
21
|
+
@server_thread = Thread.new do
|
22
|
+
Rack::Handler::Thin.run Httplog::Test::Server.new, :Port => 9292
|
23
|
+
end
|
24
|
+
sleep(3) # wait a moment for the server to be booted
|
25
|
+
|
26
|
+
RSpec.configure do |config|
|
27
|
+
|
28
|
+
config.before(:each) do
|
29
|
+
require 'stringio'
|
30
|
+
|
31
|
+
@log = StringIO.new
|
32
|
+
@logger = Logger.new @log
|
33
|
+
|
34
|
+
HttpLog.configure{ |c| c.logger = @logger }
|
35
|
+
end
|
36
|
+
|
37
|
+
config.after(:each) do
|
38
|
+
HttpLog.reset!
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def log
|
43
|
+
@log.string
|
44
|
+
end
|
45
|
+
end
|
Binary file
|
@@ -0,0 +1,17 @@
|
|
1
|
+
log4r_config:
|
2
|
+
loggers:
|
3
|
+
- name : test
|
4
|
+
level : DEBUG
|
5
|
+
trace : 'true'
|
6
|
+
outputters :
|
7
|
+
- datefile
|
8
|
+
|
9
|
+
outputters:
|
10
|
+
- type: DateFileOutputter
|
11
|
+
name: datefile
|
12
|
+
dirname: "./spec/log"
|
13
|
+
filename: "log4r.log"
|
14
|
+
formatter:
|
15
|
+
date_pattern: '%H:%M:%S'
|
16
|
+
pattern : '%d %l: %m '
|
17
|
+
type : PatternFormatter
|
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rack'
|
3
|
+
|
4
|
+
module Httplog
|
5
|
+
module Test
|
6
|
+
class Server
|
7
|
+
def call(env)
|
8
|
+
@root = File.expand_path(File.dirname(__FILE__))
|
9
|
+
path = Rack::Utils.unescape(env['PATH_INFO'])
|
10
|
+
path += 'index.html' if path == '/'
|
11
|
+
file = @root + "#{path}"
|
12
|
+
|
13
|
+
params = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
|
14
|
+
|
15
|
+
headers = {"Content-Type" => "text/html"}
|
16
|
+
|
17
|
+
if params['redirect']
|
18
|
+
[ 301, {"Location" => "/index.html"}, '' ]
|
19
|
+
|
20
|
+
elsif File.exists?(file)
|
21
|
+
headers["Content-Type"] = "application/octet-stream" if File.extname(file) == '.bin'
|
22
|
+
headers["Content-Type"] = "text/html; charset=UTF-8" if path =~ /utf8/
|
23
|
+
headers["Content-Encoding"] = "gzip" if File.extname(file) == '.gz'
|
24
|
+
[ 200, headers, File.binread(file) ]
|
25
|
+
else
|
26
|
+
[ 404, {'Content-Type' => 'text/plain'}, 'file not found' ]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,225 +1,225 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httplog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thilo Rusche
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: guard-rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thin
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: httpclient
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: httparty
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '0.16'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '0.16'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: faraday
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '0.14'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '0.14'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: excon
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: '0.60'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: '0.60'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: ethon
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
117
|
+
version: '0.11'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '0.11'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: patron
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
131
|
+
version: '0.12'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
138
|
+
version: '0.12'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: http
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
145
|
+
version: '3.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
152
|
+
version: '3.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: simplecov
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
159
|
+
version: '0.15'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
166
|
+
version: '0.15'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rake
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '12.3'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '12.3'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: listen
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 3.0
|
187
|
+
version: '3.0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 3.0
|
194
|
+
version: '3.0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: colorize
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- - "
|
199
|
+
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: '0'
|
201
|
+
version: '0.8'
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- - "
|
206
|
+
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: '0'
|
208
|
+
version: '0.8'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: rack
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- - "
|
213
|
+
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
215
|
+
version: '2.0'
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- - "
|
220
|
+
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
222
|
+
version: '2.0'
|
223
223
|
description: |-
|
224
224
|
Log outgoing HTTP requests made from your application. Helpful for tracking API calls
|
225
225
|
of third party gems that don't provide their own log output.
|
@@ -228,9 +228,21 @@ executables: []
|
|
228
228
|
extensions: []
|
229
229
|
extra_rdoc_files: []
|
230
230
|
files:
|
231
|
+
- ".gitignore"
|
232
|
+
- ".rspec"
|
233
|
+
- ".ruby-version"
|
234
|
+
- ".travis.yml"
|
235
|
+
- CHANGELOG.md
|
236
|
+
- Gemfile
|
237
|
+
- Gemfile.lock
|
238
|
+
- Guardfile
|
231
239
|
- MIT-LICENSE
|
232
240
|
- README.md
|
233
241
|
- Rakefile
|
242
|
+
- gemfiles/http2.gemfile
|
243
|
+
- gemfiles/http3.gemfile
|
244
|
+
- gemfiles/http4.gemfile
|
245
|
+
- httplog.gemspec
|
234
246
|
- lib/httplog.rb
|
235
247
|
- lib/httplog/adapters/ethon.rb
|
236
248
|
- lib/httplog/adapters/excon.rb
|
@@ -241,8 +253,31 @@ files:
|
|
241
253
|
- lib/httplog/configuration.rb
|
242
254
|
- lib/httplog/http_log.rb
|
243
255
|
- lib/httplog/version.rb
|
256
|
+
- spec/adapters/ethon_adapter.rb
|
257
|
+
- spec/adapters/excon_adapter.rb
|
258
|
+
- spec/adapters/faraday_adapter.rb
|
259
|
+
- spec/adapters/http_adapter.rb
|
260
|
+
- spec/adapters/http_base_adapter.rb
|
261
|
+
- spec/adapters/httparty_adapter.rb
|
262
|
+
- spec/adapters/httpclient_adapter.rb
|
263
|
+
- spec/adapters/net_http_adapter.rb
|
264
|
+
- spec/adapters/open_uri_adapter.rb
|
265
|
+
- spec/adapters/patron_adapter.rb
|
266
|
+
- spec/adapters/typhoeus_adapter.rb
|
267
|
+
- spec/configuration_spec.rb
|
268
|
+
- spec/http_log_spec.rb
|
269
|
+
- spec/log/.gitkeep
|
270
|
+
- spec/spec_helper.rb
|
271
|
+
- spec/support/index.html
|
272
|
+
- spec/support/index.html.gz
|
273
|
+
- spec/support/log4r.yml
|
274
|
+
- spec/support/test.bin
|
275
|
+
- spec/support/test_server.rb
|
276
|
+
- spec/support/utf8-invalid.html
|
277
|
+
- spec/support/utf8.html
|
244
278
|
homepage: http://github.com/trusche/httplog
|
245
|
-
licenses:
|
279
|
+
licenses:
|
280
|
+
- MIT
|
246
281
|
metadata: {}
|
247
282
|
post_install_message:
|
248
283
|
rdoc_options: []
|
@@ -252,7 +287,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
287
|
requirements:
|
253
288
|
- - ">="
|
254
289
|
- !ruby/object:Gem::Version
|
255
|
-
version: '
|
290
|
+
version: '2.2'
|
256
291
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
292
|
requirements:
|
258
293
|
- - ">="
|
@@ -260,8 +295,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
295
|
version: '0'
|
261
296
|
requirements: []
|
262
297
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.6.
|
298
|
+
rubygems_version: 2.6.13
|
264
299
|
signing_key:
|
265
300
|
specification_version: 4
|
266
|
-
summary:
|
301
|
+
summary: Log outgoing HTTP requests.
|
267
302
|
test_files: []
|