ddy_remote_resource 1.2.1 → 1.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b75b31568bd5a246694f34d65c20226e97c2620f7afd6f11750af62ed594b458
|
4
|
+
data.tar.gz: 3bdce3777b2ea4fc6a72371ec9e117a3f41bd304316cd0f8eb064e8fa3c0fa8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0c20de26d1ae69f00878158fa2730fffa0cf43a1b6981a55faec3e435950009700fee9d600160698b45b235d9ffa42c8ee8848bb8e5a8eaab6935461976d554
|
7
|
+
data.tar.gz: 9cd8475b745edad03b039567d5353b7a7b5077ad4d2721bd91b6b114a35d4a44554d417b060f3a069e20fa911232e5ec080183c1328f09e4e2ea1301713d3025
|
data/.travis.yml
CHANGED
@@ -42,6 +42,12 @@ module RemoteResource
|
|
42
42
|
@response.code
|
43
43
|
end
|
44
44
|
|
45
|
+
# The return code can contain additional information when response_code=0
|
46
|
+
# see https://curl.se/libcurl/c/libcurl-errors.html for the full list
|
47
|
+
def return_code
|
48
|
+
@response.return_code
|
49
|
+
end
|
50
|
+
|
45
51
|
def response_body
|
46
52
|
@response.body # TODO: Filter sensitive information using: RemoteResource::Util.filter_params
|
47
53
|
end
|
@@ -53,6 +59,7 @@ module RemoteResource
|
|
53
59
|
def to_s
|
54
60
|
message = "HTTP request failed for #{resource_klass}"
|
55
61
|
message << " with response_code=#{response_code}" if response_code.present?
|
62
|
+
message << " with return_code=#{return_code}" if return_code.present? && response_code.zero?
|
56
63
|
message << " with http_action=#{http_action}"
|
57
64
|
message << " with request_url=#{request_url}"
|
58
65
|
message
|
@@ -28,7 +28,11 @@ module RemoteResource
|
|
28
28
|
@response_code ||= @connection_response.response_code
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
alias code response_code
|
32
|
+
|
33
|
+
def return_code
|
34
|
+
@return_code ||= @connection_response.return_code
|
35
|
+
end
|
32
36
|
|
33
37
|
def headers
|
34
38
|
@headers ||= @connection_response.headers
|
@@ -682,6 +682,17 @@ RSpec.describe RemoteResource::Request do
|
|
682
682
|
end
|
683
683
|
end
|
684
684
|
|
685
|
+
context 'when the response code is 0 and no other error is raised' do
|
686
|
+
it 'raises a RemoteResource::HTTPError with correct error message' do
|
687
|
+
allow(response).to receive(:response_code) { 0 }
|
688
|
+
allow(connection_response).to receive(:return_code) { :ssl_connect }
|
689
|
+
allow(connection_response).to receive(:response_code) { 0 }
|
690
|
+
|
691
|
+
error_message = 'HTTP request failed for RemoteResource::RequestDummy with response_code=0 with return_code=ssl_connect with http_action=get with request_url=http://www.foobar.com/request_dummy.json'
|
692
|
+
expect { request.send(:raise_http_error, request, response) }.to raise_error RemoteResource::HTTPError, error_message
|
693
|
+
end
|
694
|
+
end
|
695
|
+
|
685
696
|
context 'when the response code is nothing and no other error is raised' do
|
686
697
|
it 'raises a RemoteResource::HTTPError' do
|
687
698
|
allow(response).to receive(:response_code) { nil }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddy_remote_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Digidentity
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|