httpx 0.22.1 → 0.22.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: c5485fee0a9dde3dee5e6c0dad232f00296adfe502ec5b3e7d86e910e4325a53
4
- data.tar.gz: 4b31eb7319c64d6522055e1bfc3f436433b2289cff8fcbac1a82fe2c2b356156
3
+ metadata.gz: 373c83e6252fb0439bfe307cacc18514741c9b8eaa1b9d055e1da59015c7a8f3
4
+ data.tar.gz: bc20567c842a6b6bd7d450fc6edd5ee1eb509940ffddab643a0c6a3b8ad48522
5
5
  SHA512:
6
- metadata.gz: 51ffd6a54a0b04486be732678a3a69673651777dd746950f95122493a8d580c91bf40cdbb82b6555ad01d2ccbf2bc153470ea0218a427ff7654106141c6bb4a4
7
- data.tar.gz: b3e51d51a66cc01db0870200bdf0a4427e0c749f518153bb39aa7cd18fe53d0dd4c3cb90d56c9c6e676e36aacd8edc51f005ec5e3f31e821e1ef500c81427602
6
+ metadata.gz: ff4fd33b7614c410fb30b4916ad430fbf2091d43d6bec5dfa3784564a4824491baa89f33e491db6a4a76c5cf8f4e9e07e2d5192a1214ee0f8283e345b3b1387e
7
+ data.tar.gz: 4da51a3015ef7a7f32f8e24b7e14324acda8c6a735cd3038e0a7a224376c60775ed533ee936ba58ad51639adcc16906a8ef8b637d9ef84733ac4546ed4ddd7de
@@ -0,0 +1,5 @@
1
+ # 0.22.1
2
+
3
+ ## Chore
4
+
5
+ Checking response class before calling `.status`, as this was being called in some places on error responses, thereby triggering the deprecation warning.
@@ -63,7 +63,11 @@ module HTTPX::Plugins
63
63
 
64
64
  request_info = extract_request_info(req)
65
65
  sentry_span.set_description("#{request_info[:method]} #{request_info[:url]}")
66
- sentry_span.set_data(:status, res.status)
66
+ if res.is_a?(HTTPX::ErrorResponse)
67
+ sentry_span.set_data(:error, res.message)
68
+ else
69
+ sentry_span.set_data(:status, res.status)
70
+ end
67
71
  sentry_span.set_timestamp(::Sentry.utc_now.to_f)
68
72
  end
69
73
 
@@ -46,6 +46,8 @@ module HTTPX
46
46
 
47
47
  probe_response = wrap { super(request).first }
48
48
 
49
+ return probe_response unless probe_response.is_a?(Response)
50
+
49
51
  if probe_response.status == 401 && digest.can_authenticate?(probe_response.headers["www-authenticate"])
50
52
  request.transition(:idle)
51
53
  request.headers["authorization"] = digest.authenticate(request, probe_response.headers["www-authenticate"])
@@ -50,7 +50,8 @@ module HTTPX
50
50
  end
51
51
 
52
52
  def response=(response)
53
- if response && response.status == 100 &&
53
+ if response.is_a?(Response) &&
54
+ response.status == 100 &&
54
55
  !@headers.key?("expect") &&
55
56
  (@state == :body || @state == :done)
56
57
 
@@ -92,7 +93,7 @@ module HTTPX
92
93
  response = @responses.delete(request)
93
94
  return unless response
94
95
 
95
- if response.status == 417 && request.headers.key?("expect")
96
+ if response.is_a?(Response) && response.status == 417 && request.headers.key?("expect")
96
97
  response.close
97
98
  request.headers.delete("expect")
98
99
  request.transition(:idle)
@@ -44,6 +44,7 @@ module HTTPX
44
44
 
45
45
  max_redirects = redirect_request.max_redirects
46
46
 
47
+ return response unless response.is_a?(Response)
47
48
  return response unless REDIRECT_STATUS.include?(response.status) && response.headers.key?("location")
48
49
  return response unless max_redirects.positive?
49
50
 
@@ -39,6 +39,8 @@ module HTTPX
39
39
  request.headers["authorization"] = ntlm.negotiate
40
40
  probe_response = wrap { super(request).first }
41
41
 
42
+ return probe_response unless probe_response.is_a?(Response)
43
+
42
44
  if probe_response.status == 401 && ntlm.can_authenticate?(probe_response.headers["www-authenticate"])
43
45
  request.transition(:idle)
44
46
  request.headers["authorization"] = ntlm.authenticate(request, probe_response.headers["www-authenticate"])
@@ -23,6 +23,7 @@ module HTTPX
23
23
  response = super
24
24
 
25
25
  if response &&
26
+ response.is_a?(Response) &&
26
27
  response.status == 407 &&
27
28
  !request.headers.key?("proxy-authorization") &&
28
29
  response.headers.key?("proxy-authenticate")
@@ -113,13 +114,14 @@ module HTTPX
113
114
 
114
115
  def __http_on_connect(request, response)
115
116
  @inflight -= 1
116
- if response.status == 200
117
+ if response.is_a?(Response) && response.status == 200
117
118
  req = @pending.first
118
119
  request_uri = req.uri
119
120
  @io = ProxySSL.new(@io, request_uri, @options)
120
121
  transition(:connected)
121
122
  throw(:called)
122
- elsif response.status == 407 &&
123
+ elsif response.is_a?(Response) &&
124
+ response.status == 407 &&
123
125
  !request.headers.key?("proxy-authorization") &&
124
126
  @options.proxy.can_authenticate?(response.headers["proxy-authenticate"])
125
127
 
@@ -23,6 +23,8 @@ module HTTPX
23
23
  end
24
24
 
25
25
  def retry_on_rate_limited_response(response)
26
+ return false unless response.is_a?(Response)
27
+
26
28
  status = response.status
27
29
 
28
30
  RATE_LIMIT_CODES.include?(status)
@@ -35,7 +35,9 @@ module HTTPX
35
35
  response = super
36
36
 
37
37
  if response
38
- return response unless response.respond_to?(:headers) && response.headers.key?("upgrade")
38
+ return response unless response.is_a?(Response)
39
+
40
+ return response unless response.headers.key?("upgrade")
39
41
 
40
42
  upgrade_protocol = response.headers["upgrade"].split(/ *, */).first
41
43
 
@@ -32,6 +32,8 @@ module HTTPX
32
32
  "</D:lockinfo>"
33
33
  response = request(:lock, path, headers: headers, xml: xml)
34
34
 
35
+ return response unless response.is_a?(Response)
36
+
35
37
  return response unless blk && response.status == 200
36
38
 
37
39
  lock_token = response.headers["lock-token"]
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.22.1"
4
+ VERSION = "0.22.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -90,6 +90,7 @@ extra_rdoc_files:
90
90
  - doc/release_notes/0_21_1.md
91
91
  - doc/release_notes/0_22_0.md
92
92
  - doc/release_notes/0_22_1.md
93
+ - doc/release_notes/0_22_2.md
93
94
  - doc/release_notes/0_2_0.md
94
95
  - doc/release_notes/0_2_1.md
95
96
  - doc/release_notes/0_3_0.md
@@ -172,6 +173,7 @@ files:
172
173
  - doc/release_notes/0_21_1.md
173
174
  - doc/release_notes/0_22_0.md
174
175
  - doc/release_notes/0_22_1.md
176
+ - doc/release_notes/0_22_2.md
175
177
  - doc/release_notes/0_2_0.md
176
178
  - doc/release_notes/0_2_1.md
177
179
  - doc/release_notes/0_3_0.md