sentofu 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68e190d7c3fe485d068af8a08d0fc2186a5f88a88190dcc7a847502f8be41c43
4
- data.tar.gz: 1f78480b5d3d29d2c427b1834eead05e825457afe644c6e5f9fba880d4c34b00
3
+ metadata.gz: 6b5960cd3b7ffcfe6824b87fb368fb50a7f780235bbc253962c3f4a4c2c981bd
4
+ data.tar.gz: 4f5ff2b170ce25c694bbbf7a9371183e60171a03b410989f20e70619c5b4e633
5
5
  SHA512:
6
- metadata.gz: 855aa75755835c002c54c99e6d6bd5bbc49d82a03181296029da3c8a27a437afdd05b40ddd88a8a69756f2ec9c7885eb703301b15857959fbd6143ff61b9d303
7
- data.tar.gz: a79ae6b30586c97d5f3781e4ea27a28cf406df24da887717812b674e949cc5f489abc2f71048322eb46e23d377846b6bf0f860ec2b2687bd5b13154c4d416037
6
+ metadata.gz: d3d393682b233664d071b45259ab59bb05504d52a013c16ede4f28fda80608bc1f6cf8a91b1a2ff5cdf12a433a242cb37621b2d5813472d3a02339e79f9464b8
7
+ data.tar.gz: 7e95877e0cd10deb29f684f0e31ce93f97a8b5f5a908b8a17aa8d406466cdf10571e5cf8b3a9e123ca68a30c9d04bbf48d72bb4ae7edebc994ca416b1f24ead7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## sentofu 0.5.2 released 2019-09-27
6
+
7
+ * Tighten request error interception
8
+
9
+
5
10
  ## sentofu 0.5.1 released 2019-09-10
6
11
 
7
12
  * Keep track of :_headers in result hashes
data/lib/sentofu/http.rb CHANGED
@@ -70,6 +70,9 @@ module Sentofu
70
70
 
71
71
  res = http.request(req)
72
72
 
73
+ fail "request returned a #{res.class} and not a Net::HTTPResponse" \
74
+ unless res.is_a?(Net::HTTPResponse)
75
+
73
76
  class << res
74
77
  attr_accessor :_elapsed
75
78
  def _headers; each_header.inject({}) { |h, (k, v)| h[k] = v; h }; end
@@ -91,16 +94,16 @@ module Sentofu
91
94
  _headers: res._headers,
92
95
  _elapsed: res._elapsed)
93
96
 
94
- rescue => e
97
+ rescue => err
95
98
 
96
99
  { uri: uri,
97
- code: res.code.to_i,
100
+ code: (res.code.to_i rescue nil),
98
101
  headers: res._headers,
99
- message: WEBrick::HTTPStatus.reason_phrase(res.code),
100
- error_class: e.class.to_s,
101
- error_message: e.message,
102
- error_trace: e.backtrace,
103
- body: (res.body.index('</html>') ? '<html>' : res.body) }
102
+ message: (WEBrick::HTTPStatus.reason_phrase(res.code) rescue nil),
103
+ error_class: err.class.to_s,
104
+ error_message: err.message,
105
+ error_trace: err.backtrace,
106
+ body: ((res.body.index('</html>') ? '<html>' : res.body) rescue nil) }
104
107
  end
105
108
 
106
109
  protected
data/lib/sentofu.rb CHANGED
@@ -15,7 +15,7 @@ require 'sentofu/explo'
15
15
 
16
16
  module Sentofu
17
17
 
18
- VERSION = '0.5.1'
18
+ VERSION = '0.5.2'
19
19
 
20
20
  USER_AGENT =
21
21
  "Sentofu #{Sentofu::VERSION} - " +
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentofu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-10 00:00:00.000000000 Z
11
+ date: 2019-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec