httplog 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/httplog.gemspec +2 -1
  4. data/lib/httplog/version.rb +1 -1
  5. metadata +2 -44
  6. data/.gitignore +0 -7
  7. data/.rspec +0 -2
  8. data/.rubocop.yml +0 -55
  9. data/.rubocop_todo.yml +0 -36
  10. data/.ruby-version +0 -1
  11. data/.travis.yml +0 -17
  12. data/Gemfile +0 -4
  13. data/Gemfile.lock +0 -130
  14. data/Guardfile +0 -25
  15. data/MIT-LICENSE +0 -20
  16. data/Rakefile +0 -46
  17. data/gemfiles/http3.gemfile +0 -7
  18. data/gemfiles/http4.gemfile +0 -7
  19. data/gemfiles/http5.gemfile +0 -7
  20. data/gemfiles/rack1.gemfile +0 -7
  21. data/gemfiles/rack2.gemfile +0 -7
  22. data/spec/adapters/ethon_adapter.rb +0 -26
  23. data/spec/adapters/excon_adapter.rb +0 -16
  24. data/spec/adapters/faraday_adapter.rb +0 -59
  25. data/spec/adapters/http_adapter.rb +0 -27
  26. data/spec/adapters/http_base_adapter.rb +0 -39
  27. data/spec/adapters/httparty_adapter.rb +0 -16
  28. data/spec/adapters/httpclient_adapter.rb +0 -31
  29. data/spec/adapters/net_http_adapter.rb +0 -21
  30. data/spec/adapters/open_uri_adapter.rb +0 -19
  31. data/spec/adapters/patron_adapter.rb +0 -36
  32. data/spec/adapters/typhoeus_adapter.rb +0 -28
  33. data/spec/configuration_spec.rb +0 -22
  34. data/spec/lib/http_client_spec.rb +0 -15
  35. data/spec/lib/http_log_spec.rb +0 -320
  36. data/spec/log/.gitkeep +0 -0
  37. data/spec/spec_helper.rb +0 -45
  38. data/spec/support/index.html +0 -8
  39. data/spec/support/index.html.gz +0 -0
  40. data/spec/support/log4r.yml +0 -17
  41. data/spec/support/not_gzipped.html.gz +0 -8
  42. data/spec/support/shared_examples.rb +0 -79
  43. data/spec/support/test.bin +0 -0
  44. data/spec/support/test.pdf +0 -198
  45. data/spec/support/test_server.rb +0 -34
  46. data/spec/support/utf8-invalid.html +0 -0
  47. data/spec/support/utf8.html +0 -8
File without changes
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
- $LOAD_PATH.unshift(File.dirname(__FILE__))
5
- require 'rspec'
6
- require 'httpclient'
7
- require 'excon'
8
- # require 'typhoeus'
9
- require 'ethon'
10
- require 'patron'
11
- require 'http'
12
- require 'simplecov'
13
-
14
- SimpleCov.start
15
-
16
- require 'httplog'
17
-
18
- require 'adapters/http_base_adapter'
19
- Dir[File.dirname(__FILE__) + '/adapters/*.rb'].each { |f| require f }
20
- Dir['./spec/support/**/*.rb'].each { |f| require f }
21
-
22
- # Start a local rack server to serve up test pages.
23
- @server_thread = Thread.new do
24
- Rack::Handler::Thin.run Httplog::Test::Server.new, Port: 9292
25
- end
26
- sleep(3) # wait a moment for the server to be booted
27
-
28
- RSpec.configure do |config|
29
- config.before(:each) do
30
- require 'stringio'
31
-
32
- @log = StringIO.new
33
- @logger = Logger.new @log
34
-
35
- HttpLog.configure { |c| c.logger = @logger }
36
- end
37
-
38
- config.after(:each) do
39
- HttpLog.reset!
40
- end
41
-
42
- def log
43
- @log.string
44
- end
45
- end
@@ -1,8 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Test Page</title>
4
- </head>
5
- <body>
6
- <h1>This is the test page.</h1>
7
- </body>
8
- </html>
Binary file
@@ -1,17 +0,0 @@
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
@@ -1,8 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Test Page</title>
4
- </head>
5
- <body>
6
- <h1>This is the test page.</h1>
7
- </body>
8
- </html>
@@ -1,79 +0,0 @@
1
- RSpec.shared_examples 'logs request' do |method|
2
- subject { log }
3
- it { is_expected.to include(HttpLog::LOG_PREFIX + "Sending: #{method} http://#{host}:#{port}#{path}") }
4
- end
5
-
6
- RSpec.shared_examples 'logs nothing' do
7
- subject { log }
8
- it { is_expected.to eq('') }
9
- end
10
-
11
- RSpec.shared_examples 'logs expected response' do
12
- it { is_expected.to include("Response:#{adapter.expected_response_body}") }
13
- end
14
-
15
- RSpec.shared_examples 'logs data' do
16
- # Some adapters (YOU, Faraday!) re-order the keys for no bloody
17
- # reason whatsover. So we need to check them individually. And some
18
- # (guess who?) use non-standard URL encoding for spaces...
19
- it do
20
- data.split('&').each do |param|
21
- is_expected.to match(Regexp.new(param.gsub(' ', '( |%20|\\\+)')))
22
- end
23
- end
24
- end
25
-
26
- RSpec.shared_examples 'logs status' do |status|
27
- it { is_expected.to include(["Status:", status].compact.join(' ')) }
28
- end
29
-
30
- RSpec.shared_examples 'logs benchmark' do
31
- it { is_expected.to match(/Benchmark: \d+\.\d+ seconds/) }
32
- end
33
-
34
- RSpec.shared_examples 'data logging disabled' do
35
- let(:log_data) { false }
36
- it { is_expected.to_not include('Data:') }
37
- end
38
-
39
- RSpec.shared_examples 'response logging disabled' do
40
- let(:log_response) { false }
41
- it { is_expected.to_not include('Response:') }
42
- end
43
-
44
- RSpec.shared_examples 'benchmark logging disabled' do
45
- let(:log_benchmark) { false }
46
- it { is_expected.to_not include('Benchmark:') }
47
- end
48
-
49
- RSpec.shared_examples 'with prefix response lines' do
50
- let(:prefix_response_lines) { true }
51
- it { is_expected.to include('Response:') }
52
- it { is_expected.to include('<html>') }
53
- end
54
-
55
- RSpec.shared_examples 'with line numbers' do
56
- let(:prefix_response_lines) { true }
57
- let(:prefix_line_numbers) { true }
58
- it { is_expected.to include('Response:') }
59
- it { is_expected.to include('1: <html>') }
60
- end
61
-
62
- RSpec.shared_examples 'with request logging disabled' do
63
- let(:log_request) { false }
64
- it { is_expected.to_not include('Sending: GET') }
65
- end
66
-
67
- RSpec.shared_examples 'with connection logging disabled' do
68
- let(:log_connect) { false }
69
- it { is_expected.to_not include('Connecting:') }
70
- end
71
-
72
- RSpec.shared_examples 'filtered parameters' do
73
- let(:filter_parameters) { %w(foo) }
74
-
75
- it 'masks the filtered value' do
76
- # is_expected.to include('foo=[FILTERED]&').or exclude('foo')
77
- is_expected.to_not include('secret')
78
- end
79
- end
Binary file
@@ -1,198 +0,0 @@
1
- %PDF-1.3
2
- %����
3
-
4
- 1 0 obj
5
- <<
6
- /Type /Catalog
7
- /Outlines 2 0 R
8
- /Pages 3 0 R
9
- >>
10
- endobj
11
-
12
- 2 0 obj
13
- <<
14
- /Type /Outlines
15
- /Count 0
16
- >>
17
- endobj
18
-
19
- 3 0 obj
20
- <<
21
- /Type /Pages
22
- /Count 2
23
- /Kids [ 4 0 R 6 0 R ]
24
- >>
25
- endobj
26
-
27
- 4 0 obj
28
- <<
29
- /Type /Page
30
- /Parent 3 0 R
31
- /Resources <<
32
- /Font <<
33
- /F1 9 0 R
34
- >>
35
- /ProcSet 8 0 R
36
- >>
37
- /MediaBox [0 0 612.0000 792.0000]
38
- /Contents 5 0 R
39
- >>
40
- endobj
41
-
42
- 5 0 obj
43
- << /Length 1074 >>
44
- stream
45
- 2 J
46
- BT
47
- 0 0 0 rg
48
- /F1 0027 Tf
49
- 57.3750 722.2800 Td
50
- ( A Simple PDF File ) Tj
51
- ET
52
- BT
53
- /F1 0010 Tf
54
- 69.2500 688.6080 Td
55
- ( This is a small demonstration .pdf file - ) Tj
56
- ET
57
- BT
58
- /F1 0010 Tf
59
- 69.2500 664.7040 Td
60
- ( just for use in the Virtual Mechanics tutorials. More text. And more ) Tj
61
- ET
62
- BT
63
- /F1 0010 Tf
64
- 69.2500 652.7520 Td
65
- ( text. And more text. And more text. And more text. ) Tj
66
- ET
67
- BT
68
- /F1 0010 Tf
69
- 69.2500 628.8480 Td
70
- ( And more text. And more text. And more text. And more text. And more ) Tj
71
- ET
72
- BT
73
- /F1 0010 Tf
74
- 69.2500 616.8960 Td
75
- ( text. And more text. Boring, zzzzz. And more text. And more text. And ) Tj
76
- ET
77
- BT
78
- /F1 0010 Tf
79
- 69.2500 604.9440 Td
80
- ( more text. And more text. And more text. And more text. And more text. ) Tj
81
- ET
82
- BT
83
- /F1 0010 Tf
84
- 69.2500 592.9920 Td
85
- ( And more text. And more text. ) Tj
86
- ET
87
- BT
88
- /F1 0010 Tf
89
- 69.2500 569.0880 Td
90
- ( And more text. And more text. And more text. And more text. And more ) Tj
91
- ET
92
- BT
93
- /F1 0010 Tf
94
- 69.2500 557.1360 Td
95
- ( text. And more text. And more text. Even more. Continued on page 2 ...) Tj
96
- ET
97
- endstream
98
- endobj
99
-
100
- 6 0 obj
101
- <<
102
- /Type /Page
103
- /Parent 3 0 R
104
- /Resources <<
105
- /Font <<
106
- /F1 9 0 R
107
- >>
108
- /ProcSet 8 0 R
109
- >>
110
- /MediaBox [0 0 612.0000 792.0000]
111
- /Contents 7 0 R
112
- >>
113
- endobj
114
-
115
- 7 0 obj
116
- << /Length 676 >>
117
- stream
118
- 2 J
119
- BT
120
- 0 0 0 rg
121
- /F1 0027 Tf
122
- 57.3750 722.2800 Td
123
- ( Simple PDF File 2 ) Tj
124
- ET
125
- BT
126
- /F1 0010 Tf
127
- 69.2500 688.6080 Td
128
- ( ...continued from page 1. Yet more text. And more text. And more text. ) Tj
129
- ET
130
- BT
131
- /F1 0010 Tf
132
- 69.2500 676.6560 Td
133
- ( And more text. And more text. And more text. And more text. And more ) Tj
134
- ET
135
- BT
136
- /F1 0010 Tf
137
- 69.2500 664.7040 Td
138
- ( text. Oh, how boring typing this stuff. But not as boring as watching ) Tj
139
- ET
140
- BT
141
- /F1 0010 Tf
142
- 69.2500 652.7520 Td
143
- ( paint dry. And more text. And more text. And more text. And more text. ) Tj
144
- ET
145
- BT
146
- /F1 0010 Tf
147
- 69.2500 640.8000 Td
148
- ( Boring. More, a little more text. The end, and just as well. ) Tj
149
- ET
150
- endstream
151
- endobj
152
-
153
- 8 0 obj
154
- [/PDF /Text]
155
- endobj
156
-
157
- 9 0 obj
158
- <<
159
- /Type /Font
160
- /Subtype /Type1
161
- /Name /F1
162
- /BaseFont /Helvetica
163
- /Encoding /WinAnsiEncoding
164
- >>
165
- endobj
166
-
167
- 10 0 obj
168
- <<
169
- /Creator (Rave \(http://www.nevrona.com/rave\))
170
- /Producer (Nevrona Designs)
171
- /CreationDate (D:20060301072826)
172
- >>
173
- endobj
174
-
175
- xref
176
- 0 11
177
- 0000000000 65535 f
178
- 0000000019 00000 n
179
- 0000000093 00000 n
180
- 0000000147 00000 n
181
- 0000000222 00000 n
182
- 0000000390 00000 n
183
- 0000001522 00000 n
184
- 0000001690 00000 n
185
- 0000002423 00000 n
186
- 0000002456 00000 n
187
- 0000002574 00000 n
188
-
189
- trailer
190
- <<
191
- /Size 11
192
- /Root 1 0 R
193
- /Info 10 0 R
194
- >>
195
-
196
- startxref
197
- 2714
198
- %%EOF
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubygems'
4
- require 'rack'
5
-
6
- module Httplog
7
- module Test
8
- class Server
9
- def call(env)
10
- @root = __dir__
11
- path = Rack::Utils.unescape(env['PATH_INFO'])
12
- path += 'index.html' if path == '/'
13
- file = @root + path.to_s
14
-
15
- params = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
16
-
17
- headers = { 'Content-Type' => 'text/html' }
18
-
19
- if params['redirect']
20
- [301, { 'Location' => '/index.html' }, '']
21
-
22
- elsif File.exist?(file)
23
- headers['Content-Type'] = 'application/octet-stream' if File.extname(file) == '.bin'
24
- headers['Content-Type'] = 'application/pdf' if File.extname(file) == '.pdf'
25
- headers['Content-Type'] = 'text/html; charset=UTF-8' if path =~ /utf8/
26
- headers['Content-Encoding'] = 'gzip' if File.extname(file) == '.gz'
27
- [200, headers, File.binread(file)]
28
- else
29
- [404, { 'Content-Type' => 'text/plain' }, 'file not found']
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,8 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Блог Яндекса</title>
4
- </head>
5
- <body>
6
- <h1>This is the test page.</h1>
7
- </body>
8
- </html>