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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/spectre/http.rb +9 -3
  3. data/lib/spectre.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77d4435f515a88fa60eef0a6c43b90975fb6ae1168a60294ee2847536ff51a67
4
- data.tar.gz: 1366a0d67961a565bf2020d9fa9e6724f5df4b4add1ac58712ed2cdfe992e74d
3
+ metadata.gz: b85338c15a8c29d520ed02d2e6816a64c579b6edd654f3d047fbeddb4a5c0ea3
4
+ data.tar.gz: 7be4646412f7dd3a971b21269215cddff5398cc12a50cd42dcd78a6bb70bf012
5
5
  SHA512:
6
- metadata.gz: 7699c3e1433edc8b7b0c7886f28ef90ad3f6438b2189ebbbe8bfc40c6386f7b142bd8848809af13e9c893d8efcffc6598c595fea8bdea9ff67899a84c5394e27
7
- data.tar.gz: 1b5da1f3b490dbcf2510e8a58306efe3a0924891c5004fe9862854f0700e502d81b46e8353e85b77be43f4c4aea9e67b7c4db276501f971046d47e4488c5d07f
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
- }.freeze
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.key? 'cert'
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
@@ -2,7 +2,7 @@ module Spectre
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 12
5
- TINY = 1
5
+ TINY = 2
6
6
  end
7
7
 
8
8
  VERSION = [Version::MAJOR, Version::MINOR, Version::TINY].compact * '.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectre-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.1
4
+ version: 1.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Neubauer