spectre-core 1.12.1 → 1.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spectre/http.rb +9 -3
- data/lib/spectre.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b85338c15a8c29d520ed02d2e6816a64c579b6edd654f3d047fbeddb4a5c0ea3
|
4
|
+
data.tar.gz: 7be4646412f7dd3a971b21269215cddff5398cc12a50cd42dcd78a6bb70bf012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043d7b2bda42acf5687f09ce9468c8b3ce01566c5a61d3d1c753b9d61a126898b883f00b67be67d6d61600a85143475e8b041b31fdf42f02dee5aca48260037c
|
7
|
+
data.tar.gz: 890154e9fabf2664d50289f5eeb212cd9ea508a967341d9b27a2ad5dd329600542a168352274d4a0ca09dbe9aa91f3bc22e6c855d36a80e1219ccac9132dd047
|
data/lib/spectre/http.rb
CHANGED
@@ -21,7 +21,8 @@ module Spectre
|
|
21
21
|
'query' => nil,
|
22
22
|
'content_type' => '',
|
23
23
|
'timeout' => 180,
|
24
|
-
|
24
|
+
'retries' => 0,
|
25
|
+
}
|
25
26
|
|
26
27
|
@@modules = []
|
27
28
|
|
@@ -57,6 +58,10 @@ module Spectre
|
|
57
58
|
@__req['timeout'] = seconds
|
58
59
|
end
|
59
60
|
|
61
|
+
def retries count
|
62
|
+
@__req['retries'] = count
|
63
|
+
end
|
64
|
+
|
60
65
|
def header name, value
|
61
66
|
@__req['headers'] ||= []
|
62
67
|
@__req['headers'].append [name, value.to_s.strip]
|
@@ -173,7 +178,7 @@ module Spectre
|
|
173
178
|
end
|
174
179
|
|
175
180
|
def http name, secure: false, &block
|
176
|
-
req =
|
181
|
+
req = DEFAULT_HTTP_CONFIG.clone
|
177
182
|
|
178
183
|
if @@http_cfg.key? name
|
179
184
|
req.deep_merge! @@http_cfg[name].deep_clone
|
@@ -270,11 +275,12 @@ module Spectre
|
|
270
275
|
|
271
276
|
net_http = Net::HTTP.new(uri.host, uri.port)
|
272
277
|
net_http.read_timeout = req['timeout']
|
278
|
+
net_http.max_retries = req['retries']
|
273
279
|
|
274
280
|
if uri.scheme == 'https'
|
275
281
|
net_http.use_ssl = true
|
276
282
|
|
277
|
-
if req
|
283
|
+
if req['cert']
|
278
284
|
raise HttpError.new("Certificate '#{req['cert']}' does not exist") unless File.exists? req['cert']
|
279
285
|
|
280
286
|
net_http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
data/lib/spectre.rb
CHANGED