active_rest_client 0.9.71 → 0.9.72
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_rest_client/connection.rb +6 -2
- data/lib/active_rest_client/version.rb +1 -1
- data/spec/lib/connection_spec.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 979311b6e72a88f984bed1b34c1c3fd07dde2a9d
|
4
|
+
data.tar.gz: 327b472ac5851bff68e3d74dbc7b0e127a2b85ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e9fa00e1d9530c2da3b2783fdb6c02db11c10ad251dc0e6d242d4f11a4d95418583a0e1e2d24784f9487a85e0f12b381fc04f492976b6e5f9fccb6b4445c70b
|
7
|
+
data.tar.gz: 1f0d887ec3337ee7fb414f8788e36faa96eaf05fb9a9b9cc17991e3fdd8b1cebdfb7cee808d63dcd6ab63f35cc633dd6c1e6c7f83f9491a00dc88d1ac35de5ca
|
@@ -24,13 +24,13 @@ module ActiveRestClient
|
|
24
24
|
def make_safe_request(path, &block)
|
25
25
|
block.call
|
26
26
|
rescue Faraday::TimeoutError
|
27
|
-
raise ActiveRestClient::TimeoutException.new("Timed out getting #{
|
27
|
+
raise ActiveRestClient::TimeoutException.new("Timed out getting #{full_url(path)}")
|
28
28
|
rescue Faraday::ConnectionFailed
|
29
29
|
begin
|
30
30
|
reconnect
|
31
31
|
block.call
|
32
32
|
rescue Faraday::ConnectionFailed
|
33
|
-
raise ActiveRestClient::ConnectionFailedException.new("Unable to connect to #{
|
33
|
+
raise ActiveRestClient::ConnectionFailedException.new("Unable to connect to #{full_url(path)}")
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -74,5 +74,9 @@ module ActiveRestClient
|
|
74
74
|
Faraday.new({url: @base_url}, &ActiveRestClient::Base.faraday_config)
|
75
75
|
end
|
76
76
|
|
77
|
+
|
78
|
+
def full_url(path)
|
79
|
+
@session.build_url(path).to_s
|
80
|
+
end
|
77
81
|
end
|
78
82
|
end
|
data/spec/lib/connection_spec.rb
CHANGED
@@ -108,4 +108,13 @@ describe ActiveRestClient::Connection do
|
|
108
108
|
expect { @connection.get("/foo") }.to raise_error(ActiveRestClient::TimeoutException)
|
109
109
|
end
|
110
110
|
|
111
|
+
it "should raise an exception on timeout" do
|
112
|
+
stub_request(:get, "www.example.com/foo").to_timeout
|
113
|
+
begin
|
114
|
+
@connection.get("foo")
|
115
|
+
fail
|
116
|
+
rescue ActiveRestClient::TimeoutException => timeout
|
117
|
+
expect(timeout.message).to eq("Timed out getting http://www.example.com/foo")
|
118
|
+
end
|
119
|
+
end
|
111
120
|
end
|