httpx 0.20.5 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_13_0.md +1 -1
  3. data/doc/release_notes/0_21_0.md +94 -0
  4. data/lib/httpx/connection/http1.rb +2 -1
  5. data/lib/httpx/connection.rb +41 -2
  6. data/lib/httpx/errors.rb +18 -0
  7. data/lib/httpx/extensions.rb +8 -4
  8. data/lib/httpx/io/unix.rb +1 -1
  9. data/lib/httpx/options.rb +7 -3
  10. data/lib/httpx/plugins/circuit_breaker/circuit.rb +76 -0
  11. data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +44 -0
  12. data/lib/httpx/plugins/circuit_breaker.rb +115 -0
  13. data/lib/httpx/plugins/cookies.rb +1 -1
  14. data/lib/httpx/plugins/expect.rb +1 -1
  15. data/lib/httpx/plugins/multipart/decoder.rb +1 -1
  16. data/lib/httpx/plugins/proxy.rb +7 -1
  17. data/lib/httpx/plugins/retries.rb +1 -1
  18. data/lib/httpx/plugins/webdav.rb +78 -0
  19. data/lib/httpx/request.rb +15 -25
  20. data/lib/httpx/resolver/https.rb +2 -7
  21. data/lib/httpx/resolver/native.rb +2 -1
  22. data/lib/httpx/response.rb +27 -9
  23. data/lib/httpx/timers.rb +3 -0
  24. data/lib/httpx/transcoder/form.rb +1 -1
  25. data/lib/httpx/transcoder/json.rb +19 -3
  26. data/lib/httpx/transcoder/xml.rb +57 -0
  27. data/lib/httpx/transcoder.rb +1 -0
  28. data/lib/httpx/version.rb +1 -1
  29. data/sig/buffer.rbs +1 -1
  30. data/sig/chainable.rbs +1 -0
  31. data/sig/connection.rbs +12 -4
  32. data/sig/errors.rbs +13 -0
  33. data/sig/io.rbs +6 -0
  34. data/sig/options.rbs +4 -1
  35. data/sig/plugins/circuit_breaker.rbs +61 -0
  36. data/sig/plugins/compression/brotli.rbs +1 -1
  37. data/sig/plugins/compression/deflate.rbs +1 -1
  38. data/sig/plugins/compression/gzip.rbs +3 -3
  39. data/sig/plugins/compression.rbs +1 -1
  40. data/sig/plugins/multipart.rbs +1 -1
  41. data/sig/plugins/proxy/socks5.rbs +3 -2
  42. data/sig/plugins/proxy.rbs +1 -1
  43. data/sig/registry.rbs +5 -4
  44. data/sig/request.rbs +7 -1
  45. data/sig/resolver/native.rbs +5 -2
  46. data/sig/response.rbs +3 -1
  47. data/sig/timers.rbs +1 -1
  48. data/sig/transcoder/json.rbs +4 -1
  49. data/sig/transcoder/xml.rbs +21 -0
  50. data/sig/transcoder.rbs +2 -2
  51. data/sig/utils.rbs +2 -2
  52. metadata +12 -2
@@ -21,7 +21,7 @@ module HTTPX
21
21
 
22
22
  private
23
23
 
24
- def initialize: (uri: generic_uri, ?scheme: String, ?username: String, ?password: String, **extra) -> untyped
24
+ def initialize: (uri: generic_uri, ?scheme: String, ?username: String, ?password: String, **untyped) -> untyped
25
25
  end
26
26
 
27
27
  def self.configure: (singleton(Session)) -> void
data/sig/registry.rbs CHANGED
@@ -1,12 +1,13 @@
1
- module HTTPX::Registry[T, V]
1
+ module HTTPX::Registry[unchecked out T, unchecked out V]
2
2
  class Error < HTTPX::Error
3
3
  end
4
4
 
5
5
  # type registrable = Symbol | String | Class
6
6
 
7
- def self.registry: (T tag) -> Class
8
- | () -> Hash[T, V]
9
- def self.register: (T tag, V handler) -> void
7
+ def self.registry: [T, V] (T) -> Class
8
+ | [T, V] () -> Hash[T, V]
9
+
10
+ def self.register: [T, V] (T tag, V handler) -> void
10
11
 
11
12
  def registry: (?T tag) -> V
12
13
  end
data/sig/request.rbs CHANGED
@@ -50,6 +50,12 @@ module HTTPX
50
50
 
51
51
  def trailers?: () -> boolish
52
52
 
53
+ def read_timeout: () -> Numeric
54
+
55
+ def write_timeout: () -> Numeric
56
+
57
+ def request_timeout: () -> Numeric
58
+
53
59
  class Body
54
60
  @headers: Headers
55
61
  @body: body_encoder?
@@ -61,7 +67,7 @@ module HTTPX
61
67
 
62
68
  def rewind: () -> void
63
69
  def empty?: () -> bool
64
- def bytesize: () -> Numeric
70
+ def bytesize: () -> (Integer | Float)
65
71
  def stream: (Transcoder::_Encoder) -> bodyIO
66
72
  def unbounded_body?: () -> bool
67
73
  def chunked?: () -> bool
@@ -10,7 +10,10 @@ module HTTPX
10
10
  @family: ip_family
11
11
  @options: Options
12
12
  @ns_index: Integer
13
- @nameserver: String
13
+ @nameserver: Array[String]?
14
+ @ndots: Integer
15
+ @start_timeout: Float?
16
+ @search: Array[String]
14
17
  @_timeouts: Array[Numeric]
15
18
  @timeouts: Hash[String, Array[Numeric]]
16
19
  @connections: Array[Connection]
@@ -37,7 +40,7 @@ module HTTPX
37
40
 
38
41
  def consume: () -> void
39
42
 
40
- def do_retry: (?Numeric loop_time) -> void
43
+ def do_retry: (?Numeric? loop_time) -> void
41
44
 
42
45
  def dread: (Integer) -> void
43
46
  | () -> void
data/sig/response.rbs CHANGED
@@ -1,5 +1,7 @@
1
1
  module HTTPX
2
2
  interface _Response
3
+ def finished?: () -> bool
4
+
3
5
  def raise_for_status: () -> self
4
6
 
5
7
  def error: () -> StandardError?
@@ -61,7 +63,7 @@ module HTTPX
61
63
  def each: () { (String) -> void } -> void
62
64
  | () -> Enumerable[String]
63
65
 
64
- def bytesize: () -> Numeric
66
+ def bytesize: () -> (Integer | Float)
65
67
  def empty?: () -> bool
66
68
  def copy_to: (String | File | _Writer destination) -> void
67
69
  def close: () -> void
data/sig/timers.rbs CHANGED
@@ -1,7 +1,7 @@
1
1
  module HTTPX
2
2
  class Timers
3
3
  @intervals: Array[Interval]
4
- @next_interval_at: Numeric
4
+ @next_interval_at: Float
5
5
 
6
6
  def after: (Numeric interval_in_secs) { () -> void } -> void
7
7
 
@@ -5,6 +5,9 @@ module HTTPX::Transcoder
5
5
  def self?.encode: (_ToJson json) -> Encoder
6
6
  def self?.decode: (HTTPX::Response response) -> _Decoder
7
7
 
8
+ def self?.json_load: (string source, ?json_options) -> untyped
9
+ def self?.json_dump: (_ToJson obj, *untyped) -> String
10
+
8
11
  class Encoder
9
12
  extend Forwardable
10
13
  include _Encoder
@@ -17,7 +20,7 @@ module HTTPX::Transcoder
17
20
 
18
21
  private
19
22
 
20
- def initialize: (_ToJson json) -> untyped
23
+ def initialize: (_ToJson json) -> void
21
24
  end
22
25
  end
23
26
  end
@@ -0,0 +1,21 @@
1
+ module HTTPX::Transcoder
2
+ module XML
3
+
4
+ def self?.encode: (untyped xml) -> Encoder
5
+ def self?.decode: (HTTPX::Response response) -> _Decoder
6
+
7
+ class Encoder
8
+ @raw: untyped # can be nokogiri object
9
+
10
+ def content_type: () -> String
11
+
12
+ def bytesize: () -> (Integer | Float)
13
+
14
+ def to_s: () -> String
15
+
16
+ private
17
+
18
+ def initialize: (String xml) -> void
19
+ end
20
+ end
21
+ end
data/sig/transcoder.rbs CHANGED
@@ -18,11 +18,11 @@ module HTTPX
18
18
  end
19
19
 
20
20
  interface _Encoder
21
- def bytesize: () -> Numeric
21
+ def bytesize: () -> (Integer | Float)
22
22
  end
23
23
 
24
24
  interface _Decoder
25
- def call: (Response response, untyped options) -> untyped
25
+ def call: (Response response, *untyped) -> untyped
26
26
  end
27
27
  end
28
28
  end
data/sig/utils.rbs CHANGED
@@ -4,9 +4,9 @@ module HTTPX
4
4
 
5
5
  def self?.parse_retry_after: (String) -> Numeric
6
6
 
7
- def self?.now: () -> Numeric
7
+ def self?.now: () -> Float
8
8
 
9
- def self?.elapsed_time: (Numeric monotonic_time) -> Numeric
9
+ def self?.elapsed_time: (Integer | Float monotonic_time) -> Float
10
10
 
11
11
  def self?.to_uri: (generic_uri uri) -> URI::Generic
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.5
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-10 00:00:00.000000000 Z
11
+ date: 2022-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -86,6 +86,7 @@ extra_rdoc_files:
86
86
  - doc/release_notes/0_20_3.md
87
87
  - doc/release_notes/0_20_4.md
88
88
  - doc/release_notes/0_20_5.md
89
+ - doc/release_notes/0_21_0.md
89
90
  - doc/release_notes/0_2_0.md
90
91
  - doc/release_notes/0_2_1.md
91
92
  - doc/release_notes/0_3_0.md
@@ -164,6 +165,7 @@ files:
164
165
  - doc/release_notes/0_20_3.md
165
166
  - doc/release_notes/0_20_4.md
166
167
  - doc/release_notes/0_20_5.md
168
+ - doc/release_notes/0_21_0.md
167
169
  - doc/release_notes/0_2_0.md
168
170
  - doc/release_notes/0_2_1.md
169
171
  - doc/release_notes/0_3_0.md
@@ -217,6 +219,9 @@ files:
217
219
  - lib/httpx/plugins/aws_sdk_authentication.rb
218
220
  - lib/httpx/plugins/aws_sigv4.rb
219
221
  - lib/httpx/plugins/basic_authentication.rb
222
+ - lib/httpx/plugins/circuit_breaker.rb
223
+ - lib/httpx/plugins/circuit_breaker/circuit.rb
224
+ - lib/httpx/plugins/circuit_breaker/circuit_store.rb
220
225
  - lib/httpx/plugins/compression.rb
221
226
  - lib/httpx/plugins/compression/brotli.rb
222
227
  - lib/httpx/plugins/compression/deflate.rb
@@ -253,6 +258,7 @@ files:
253
258
  - lib/httpx/plugins/stream.rb
254
259
  - lib/httpx/plugins/upgrade.rb
255
260
  - lib/httpx/plugins/upgrade/h2.rb
261
+ - lib/httpx/plugins/webdav.rb
256
262
  - lib/httpx/pmatch_extensions.rb
257
263
  - lib/httpx/pool.rb
258
264
  - lib/httpx/punycode.rb
@@ -275,6 +281,7 @@ files:
275
281
  - lib/httpx/transcoder/chunker.rb
276
282
  - lib/httpx/transcoder/form.rb
277
283
  - lib/httpx/transcoder/json.rb
284
+ - lib/httpx/transcoder/xml.rb
278
285
  - lib/httpx/utils.rb
279
286
  - lib/httpx/version.rb
280
287
  - sig/buffer.rbs
@@ -287,6 +294,7 @@ files:
287
294
  - sig/errors.rbs
288
295
  - sig/headers.rbs
289
296
  - sig/httpx.rbs
297
+ - sig/io.rbs
290
298
  - sig/loggable.rbs
291
299
  - sig/options.rbs
292
300
  - sig/parser/http1.rbs
@@ -298,6 +306,7 @@ files:
298
306
  - sig/plugins/aws_sdk_authentication.rbs
299
307
  - sig/plugins/aws_sigv4.rbs
300
308
  - sig/plugins/basic_authentication.rbs
309
+ - sig/plugins/circuit_breaker.rbs
301
310
  - sig/plugins/compression.rbs
302
311
  - sig/plugins/compression/brotli.rbs
303
312
  - sig/plugins/compression/deflate.rbs
@@ -342,6 +351,7 @@ files:
342
351
  - sig/transcoder/chunker.rbs
343
352
  - sig/transcoder/form.rbs
344
353
  - sig/transcoder/json.rbs
354
+ - sig/transcoder/xml.rbs
345
355
  - sig/utils.rbs
346
356
  homepage: https://gitlab.com/honeyryderchuck/httpx
347
357
  licenses: