httplog 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
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 |method|
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 |data|
16
+ it { is_expected.to include(["Data:", data].compact.join(' ')) }
17
+ end
18
+
19
+ RSpec.shared_examples 'logs status' do |status|
20
+ it { is_expected.to include(["Status:", status].compact.join(' ')) }
21
+ end
22
+
23
+ RSpec.shared_examples 'logs benchmark' do |data|
24
+ it { is_expected.to match(/Benchmark: \d+\.\d+ seconds/) }
25
+ end
26
+
27
+ RSpec.shared_examples 'data logging disabled' do
28
+ let(:log_data) { false }
29
+ it { is_expected.to_not include('Data:') }
30
+ end
31
+
32
+ RSpec.shared_examples 'response logging disabled' do
33
+ let(:log_response) { false }
34
+ it { is_expected.to_not include('Response:') }
35
+ end
36
+
37
+ RSpec.shared_examples 'benchmark logging disabled' do
38
+ let(:log_benchmark) { false }
39
+ it { is_expected.to_not include('Benchmark:') }
40
+ end
41
+
42
+ RSpec.shared_examples 'with prefix response lines' do
43
+ let(:prefix_response_lines) { true }
44
+ it { is_expected.to include('Response:') }
45
+ it { is_expected.to include('<html>') }
46
+ end
47
+
48
+ RSpec.shared_examples 'with line numbers' do
49
+ let(:prefix_response_lines) { true }
50
+ let(:prefix_line_numbers) { true }
51
+ it { is_expected.to include('Response:') }
52
+ it { is_expected.to include('1: <html>') }
53
+ end
54
+
55
+ RSpec.shared_examples 'with request logging disabled' do
56
+ let(:log_request) { false }
57
+ it { is_expected.to_not include('Sending: GET') }
58
+ end
59
+
60
+ RSpec.shared_examples 'with connection logging disabled' do
61
+ let(:log_connect) { false }
62
+ it { is_expected.to_not include('Connecting:') }
63
+ end
@@ -0,0 +1,198 @@
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
@@ -21,6 +21,7 @@ module Httplog
21
21
 
22
22
  elsif File.exist?(file)
23
23
  headers['Content-Type'] = 'application/octet-stream' if File.extname(file) == '.bin'
24
+ headers['Content-Type'] = 'application/pdf' if File.extname(file) == '.pdf'
24
25
  headers['Content-Type'] = 'text/html; charset=UTF-8' if path =~ /utf8/
25
26
  headers['Content-Encoding'] = 'gzip' if File.extname(file) == '.gz'
26
27
  [200, headers, File.binread(file)]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httplog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thilo Rusche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-30 00:00:00.000000000 Z
11
+ date: 2018-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ethon
@@ -277,7 +277,9 @@ files:
277
277
  - spec/support/index.html.gz
278
278
  - spec/support/log4r.yml
279
279
  - spec/support/not_gzipped.html.gz
280
+ - spec/support/shared_examples.rb
280
281
  - spec/support/test.bin
282
+ - spec/support/test.pdf
281
283
  - spec/support/test_server.rb
282
284
  - spec/support/utf8-invalid.html
283
285
  - spec/support/utf8.html