azure-core 0.1.13 → 0.1.14
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/azure/core/http/http_error.rb +2 -0
- data/lib/azure/core/http/http_response.rb +7 -1
- data/lib/azure/core/http/retry_policy.rb +13 -9
- data/lib/azure/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ecaa67ebbb25aea7d1135114553af7386b637bd9cca5a45ef43e23620abb56f
|
4
|
+
data.tar.gz: c502f5b8da53214842f6eee44afbb230b7b4ce142c96f9d81ec68a9e49deb495
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e3e38ca1dcca9e79a8e0f1ef2a80606941434370c5a9604b72221ba53f9ca4e6d697b26faea3ddb83caef25031b985f3b273eced299c4f6499cf0d7820549d1
|
7
|
+
data.tar.gz: 1737a87e679bcd1a7351e0e0c9c67fc0e22258fb9bb77f678d7974ff7701aeef3cc5c2b7e399c264d8584215e9b5744de175550f36a45a8a46be7b8052c2fb91
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 2017.12.28 - azure-core gem @version 0.1.14
|
2
|
+
* Added `reason_phrase` as an alternative for HTTP error description if no error details is found in response body
|
3
|
+
* Fixed a bug of re-throwing previously stored response error when it retries. [#51](https://github.com/Azure/azure-ruby-asm-core/issues/51)
|
4
|
+
* Fixed a bug that retries exceed the limit after many requests fail. [#57](https://github.com/Azure/azure-ruby-asm-core/issues/57)
|
5
|
+
|
1
6
|
# 2017.11.10 - azure-core gem @version 0.1.13
|
2
7
|
* Added the call options in the retry data.
|
3
8
|
* Added the support for retrying a request with a different URL.
|
@@ -72,6 +72,8 @@ module Azure
|
|
72
72
|
@uri = http_response.uri
|
73
73
|
@status_code = http_response.status_code
|
74
74
|
parse_response
|
75
|
+
# Use reason phrase as the description if description is empty
|
76
|
+
@description = http_response.reason_phrase if (@description.nil? || @description.empty?) && http_response.reason_phrase
|
75
77
|
super("#{type} (#{status_code}): #{description}")
|
76
78
|
end
|
77
79
|
|
@@ -19,7 +19,6 @@ module Azure
|
|
19
19
|
module Http
|
20
20
|
# A small proxy to clean up the API of Net::HTTPResponse.
|
21
21
|
class HttpResponse
|
22
|
-
|
23
22
|
# Public: Initialize a new response.
|
24
23
|
#
|
25
24
|
# http_response - A Net::HTTPResponse.
|
@@ -44,6 +43,13 @@ module Azure
|
|
44
43
|
@http_response.status
|
45
44
|
end
|
46
45
|
|
46
|
+
# Public: Get the response reason phrase.
|
47
|
+
#
|
48
|
+
# Returns a String.
|
49
|
+
def reason_phrase
|
50
|
+
@http_response.reason_phrase
|
51
|
+
end
|
52
|
+
|
47
53
|
# Public: Check if this response was successful. A request is considered
|
48
54
|
# successful if the response is in the 200 - 399 range.
|
49
55
|
#
|
@@ -37,21 +37,25 @@ module Azure
|
|
37
37
|
# _next - HttpFilter. The next filter in the pipeline
|
38
38
|
def call(req, _next)
|
39
39
|
response = nil
|
40
|
+
retry_data = @retry_data.dup
|
40
41
|
begin
|
41
42
|
# URI could change in the retry, e.g. secondary endpoint
|
42
|
-
unless
|
43
|
-
req.uri =
|
43
|
+
unless retry_data[:uri].nil?
|
44
|
+
req.uri = retry_data[:uri]
|
44
45
|
end
|
46
|
+
|
47
|
+
retry_data[:error] = nil
|
45
48
|
response = _next.call
|
46
49
|
rescue
|
47
|
-
|
48
|
-
end while should_retry?(response,
|
50
|
+
retry_data[:error] = $!
|
51
|
+
end while should_retry?(response, retry_data)
|
52
|
+
|
49
53
|
# Assign the error when HTTP error is not thrown from the previous filter
|
50
|
-
|
51
|
-
if
|
52
|
-
raise @retry_data[:error]
|
53
|
-
else
|
54
|
+
retry_data[:error] = response.error if response && !response.success?
|
55
|
+
if retry_data[:error].nil?
|
54
56
|
response
|
57
|
+
else
|
58
|
+
raise retry_data[:error]
|
55
59
|
end
|
56
60
|
end
|
57
61
|
|
@@ -77,4 +81,4 @@ module Azure
|
|
77
81
|
end
|
78
82
|
end
|
79
83
|
end
|
80
|
-
end
|
84
|
+
end
|
data/lib/azure/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
211
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.7.
|
212
|
+
rubygems_version: 2.7.4
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: Core library to be consumed by Ruby SDK gems
|