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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/sentofu/http.rb +10 -7
- data/lib/sentofu.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b5960cd3b7ffcfe6824b87fb368fb50a7f780235bbc253962c3f4a4c2c981bd
|
4
|
+
data.tar.gz: 4f5ff2b170ce25c694bbbf7a9371183e60171a03b410989f20e70619c5b4e633
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3d393682b233664d071b45259ab59bb05504d52a013c16ede4f28fda80608bc1f6cf8a91b1a2ff5cdf12a433a242cb37621b2d5813472d3a02339e79f9464b8
|
7
|
+
data.tar.gz: 7e95877e0cd10deb29f684f0e31ce93f97a8b5f5a908b8a17aa8d406466cdf10571e5cf8b3a9e123ca68a30c9d04bbf48d72bb4ae7edebc994ca416b1f24ead7
|
data/CHANGELOG.md
CHANGED
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 =>
|
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:
|
101
|
-
error_message:
|
102
|
-
error_trace:
|
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
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.
|
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-
|
11
|
+
date: 2019-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|