azure-core 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28eb15120a2cc99f76064d85594a4126e014ff83be784b7ee8b6c7bc1dcaed0c
4
- data.tar.gz: 6ae6620c660aa76e47841fb01d3a7089c044fd404feebc187568c6bfc1d0980d
3
+ metadata.gz: 0ecaa67ebbb25aea7d1135114553af7386b637bd9cca5a45ef43e23620abb56f
4
+ data.tar.gz: c502f5b8da53214842f6eee44afbb230b7b4ce142c96f9d81ec68a9e49deb495
5
5
  SHA512:
6
- metadata.gz: d182d7cb1c220bfb20dac275166c1d948b25ef6ca5a914c7b450829dc04ca2d90a7b2dec7814bd458d5eed76408ac3b659a919e8653058ce5076f8674caa73c2
7
- data.tar.gz: 7e3f948e02cf99a942e1bb5199a1020b5b09c821a7683dd58da2221f46dadec6f9acd627ab212b6c140e2c9b020fd6a17d820ec7375277183f920638e8028ac2
6
+ metadata.gz: 0e3e38ca1dcca9e79a8e0f1ef2a80606941434370c5a9604b72221ba53f9ca4e6d697b26faea3ddb83caef25031b985f3b273eced299c4f6499cf0d7820549d1
7
+ data.tar.gz: 1737a87e679bcd1a7351e0e0c9c67fc0e22258fb9bb77f678d7974ff7701aeef3cc5c2b7e399c264d8584215e9b5744de175550f36a45a8a46be7b8052c2fb91
@@ -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 @retry_data[:uri].nil?
43
- req.uri = @retry_data[: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
- @retry_data[:error] = $!
48
- end while should_retry?(response, @retry_data)
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
- @retry_data[:error] = response.error if response && !response.success?
51
- if @retry_data.has_key?(:error)
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
@@ -18,7 +18,7 @@ module Azure
18
18
  class Version
19
19
  MAJOR = 0 unless defined? MAJOR
20
20
  MINOR = 1 unless defined? MINOR
21
- UPDATE = 13 unless defined? UPDATE
21
+ UPDATE = 14 unless defined? UPDATE
22
22
  PRE = nil unless defined? PRE
23
23
 
24
24
  class << self
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.13
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-11-14 00:00:00.000000000 Z
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.2
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