httpx 0.20.3 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_13_0.md +1 -1
  3. data/doc/release_notes/0_20_4.md +17 -0
  4. data/doc/release_notes/0_20_5.md +3 -0
  5. data/doc/release_notes/0_21_0.md +94 -0
  6. data/lib/httpx/connection/http1.rb +2 -1
  7. data/lib/httpx/connection.rb +41 -2
  8. data/lib/httpx/errors.rb +18 -0
  9. data/lib/httpx/extensions.rb +36 -13
  10. data/lib/httpx/io/unix.rb +1 -1
  11. data/lib/httpx/options.rb +7 -3
  12. data/lib/httpx/plugins/circuit_breaker/circuit.rb +76 -0
  13. data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +44 -0
  14. data/lib/httpx/plugins/circuit_breaker.rb +115 -0
  15. data/lib/httpx/plugins/compression.rb +1 -1
  16. data/lib/httpx/plugins/cookies.rb +1 -1
  17. data/lib/httpx/plugins/expect.rb +1 -1
  18. data/lib/httpx/plugins/multipart/decoder.rb +1 -1
  19. data/lib/httpx/plugins/proxy.rb +7 -1
  20. data/lib/httpx/plugins/response_cache/store.rb +39 -19
  21. data/lib/httpx/plugins/response_cache.rb +98 -8
  22. data/lib/httpx/plugins/retries.rb +1 -1
  23. data/lib/httpx/plugins/webdav.rb +78 -0
  24. data/lib/httpx/pool.rb +1 -1
  25. data/lib/httpx/request.rb +15 -25
  26. data/lib/httpx/resolver/https.rb +2 -7
  27. data/lib/httpx/resolver/multi.rb +1 -1
  28. data/lib/httpx/resolver/native.rb +2 -1
  29. data/lib/httpx/resolver/resolver.rb +12 -2
  30. data/lib/httpx/response.rb +30 -9
  31. data/lib/httpx/timers.rb +3 -0
  32. data/lib/httpx/transcoder/body.rb +1 -1
  33. data/lib/httpx/transcoder/form.rb +1 -1
  34. data/lib/httpx/transcoder/json.rb +19 -3
  35. data/lib/httpx/transcoder/xml.rb +57 -0
  36. data/lib/httpx/transcoder.rb +1 -0
  37. data/lib/httpx/version.rb +1 -1
  38. data/sig/buffer.rbs +1 -1
  39. data/sig/chainable.rbs +1 -0
  40. data/sig/connection.rbs +12 -4
  41. data/sig/errors.rbs +13 -0
  42. data/sig/io.rbs +6 -0
  43. data/sig/options.rbs +4 -1
  44. data/sig/plugins/circuit_breaker.rbs +61 -0
  45. data/sig/plugins/compression/brotli.rbs +1 -1
  46. data/sig/plugins/compression/deflate.rbs +1 -1
  47. data/sig/plugins/compression/gzip.rbs +3 -3
  48. data/sig/plugins/compression.rbs +1 -1
  49. data/sig/plugins/multipart.rbs +1 -1
  50. data/sig/plugins/proxy/socks5.rbs +3 -2
  51. data/sig/plugins/proxy.rbs +1 -1
  52. data/sig/plugins/response_cache.rbs +24 -4
  53. data/sig/registry.rbs +5 -4
  54. data/sig/request.rbs +7 -1
  55. data/sig/resolver/native.rbs +5 -2
  56. data/sig/response.rbs +6 -1
  57. data/sig/timers.rbs +1 -1
  58. data/sig/transcoder/json.rbs +4 -1
  59. data/sig/transcoder/xml.rbs +21 -0
  60. data/sig/transcoder.rbs +2 -2
  61. data/sig/utils.rbs +2 -2
  62. metadata +17 -3
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "forwardable"
4
- require "json"
5
4
 
6
5
  module HTTPX::Transcoder
7
6
  module JSON
@@ -19,7 +18,7 @@ module HTTPX::Transcoder
19
18
  def_delegator :@raw, :bytesize
20
19
 
21
20
  def initialize(json)
22
- @raw = ::JSON.dump(json)
21
+ @raw = JSON.json_dump(json)
23
22
  @charset = @raw.encoding.name.downcase
24
23
  end
25
24
 
@@ -37,8 +36,25 @@ module HTTPX::Transcoder
37
36
 
38
37
  raise HTTPX::Error, "invalid json mime type (#{content_type})" unless JSON_REGEX.match?(content_type)
39
38
 
40
- ::JSON.method(:parse)
39
+ method(:json_load)
41
40
  end
41
+
42
+ # rubocop:disable Style/SingleLineMethods
43
+ if defined?(MultiJson)
44
+ def json_load(*args); MultiJson.load(*args); end
45
+ def json_dump(*args); MultiJson.dump(*args); end
46
+ elsif defined?(Oj)
47
+ def json_load(response, *args); Oj.load(response.to_s, *args); end
48
+ def json_dump(*args); Oj.dump(*args); end
49
+ elsif defined?(Yajl)
50
+ def json_load(response, *args); Yajl::Parser.new(*args).parse(response.to_s); end
51
+ def json_dump(*args); Yajl::Encoder.encode(*args); end
52
+ else
53
+ require "json"
54
+ def json_load(*args); ::JSON.parse(*args); end
55
+ def json_dump(*args); ::JSON.dump(*args); end
56
+ end
57
+ # rubocop:enable Style/SingleLineMethods
42
58
  end
43
59
  register "json", JSON
44
60
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "delegate"
4
+ require "forwardable"
5
+ require "uri"
6
+
7
+ module HTTPX::Transcoder
8
+ module Xml
9
+ using HTTPX::RegexpExtensions
10
+
11
+ module_function
12
+
13
+ MIME_TYPES = %r{\b(application|text)/(.+\+)?xml\b}.freeze
14
+
15
+ class Encoder
16
+ def initialize(xml)
17
+ @raw = xml
18
+ end
19
+
20
+ def content_type
21
+ charset = @raw.respond_to?(:encoding) ? @raw.encoding.to_s.downcase : "utf-8"
22
+ "application/xml; charset=#{charset}"
23
+ end
24
+
25
+ def bytesize
26
+ @raw.to_s.bytesize
27
+ end
28
+
29
+ def to_s
30
+ @raw.to_s
31
+ end
32
+ end
33
+
34
+ def encode(xml)
35
+ Encoder.new(xml)
36
+ end
37
+
38
+ begin
39
+ require "nokogiri"
40
+
41
+ # rubocop:disable Lint/DuplicateMethods
42
+ def decode(response)
43
+ content_type = response.content_type.mime_type
44
+
45
+ raise HTTPX::Error, "invalid form mime type (#{content_type})" unless MIME_TYPES.match?(content_type)
46
+
47
+ Nokogiri::XML.method(:parse)
48
+ end
49
+ rescue LoadError
50
+ def decode(_response)
51
+ raise HTTPX::Error, "\"nokogiri\" is required in order to decode XML"
52
+ end
53
+ end
54
+ # rubocop:enable Lint/DuplicateMethods
55
+ end
56
+ register "xml", Xml
57
+ end
@@ -90,4 +90,5 @@ end
90
90
  require "httpx/transcoder/body"
91
91
  require "httpx/transcoder/form"
92
92
  require "httpx/transcoder/json"
93
+ require "httpx/transcoder/xml"
93
94
  require "httpx/transcoder/chunker"
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.20.3"
4
+ VERSION = "0.21.0"
5
5
  end
data/sig/buffer.rbs CHANGED
@@ -15,7 +15,7 @@ module HTTPX
15
15
  # delegated
16
16
  def <<: (string data) -> String
17
17
  def empty?: () -> bool
18
- def bytesize: () -> Integer
18
+ def bytesize: () -> (Integer | Float)
19
19
  def clear: () -> void
20
20
  def replace: (string) -> void
21
21
 
data/sig/chainable.rbs CHANGED
@@ -33,6 +33,7 @@ module HTTPX
33
33
  | (:aws_sigv4, ?options) -> Plugins::awsSigV4Session
34
34
  | (:grpc, ?options) -> Plugins::grpcSession
35
35
  | (:response_cache, ?options) -> Plugins::sessionResponseCache
36
+ | (:circuit_breaker, ?options) -> Plugins::sessionCircuitBreaker
36
37
  | (Symbol | Module, ?options) { (Class) -> void } -> Session
37
38
  | (Symbol | Module, ?options) -> Session
38
39
 
data/sig/connection.rbs CHANGED
@@ -28,7 +28,7 @@ module HTTPX
28
28
  attr_reader options: Options
29
29
  attr_writer timers: Timers
30
30
 
31
- @origins: Array[URI::Generic]
31
+ @type: io_type
32
32
  @window_size: Integer
33
33
  @read_buffer: Buffer
34
34
  @write_buffer: Buffer
@@ -40,7 +40,7 @@ module HTTPX
40
40
 
41
41
  def addresses=: (Array[ipaddr]) -> void
42
42
 
43
- def match?: (URI::Generic, options) -> bool
43
+ def match?: (URI::Generic uri, Options options) -> bool
44
44
 
45
45
  def mergeable?: (Connection) -> bool
46
46
 
@@ -54,13 +54,15 @@ module HTTPX
54
54
 
55
55
  def match_altsvcs?: (URI::Generic uri) -> bool
56
56
 
57
+ def match_altsvc_options?: (URI::Generic uri, Options options) -> bool
58
+
57
59
  def connecting?: () -> bool
58
60
 
59
61
  def inflight?: () -> boolish
60
62
 
61
63
  def interests: () -> io_interests?
62
64
 
63
- def to_io: () -> IO
65
+ def to_io: () -> ::IO
64
66
 
65
67
  def call: () -> void
66
68
 
@@ -77,7 +79,7 @@ module HTTPX
77
79
 
78
80
  private
79
81
 
80
- def initialize: (String, URI::Generic, options) -> untyped
82
+ def initialize: (io_type, URI::Generic, options) -> untyped
81
83
 
82
84
  def connect: () -> void
83
85
 
@@ -103,5 +105,11 @@ module HTTPX
103
105
  def handle_error: (StandardError) -> void
104
106
 
105
107
  def purge_after_closed: () -> void
108
+
109
+ def set_request_timeouts: (Request request) -> void
110
+
111
+ def write_timeout_callback: (Request request, Numeric write_timeout) -> void
112
+
113
+ def read_timeout_callback: (Request request, Numeric read_timeout, ?singleton(RequestTimeoutError) error_type) -> void
106
114
  end
107
115
  end
data/sig/errors.rbs CHANGED
@@ -23,6 +23,19 @@ module HTTPX
23
23
  class ResolveTimeoutError < TimeoutError
24
24
  end
25
25
 
26
+ class RequestTimeoutError < TimeoutError
27
+ attr_reader request: Request
28
+ attr_reader response: response?
29
+
30
+ def initialize: (Request request, response? response, Numeric timeout) -> void
31
+ end
32
+
33
+ class ReadTimeoutError < RequestTimeoutError
34
+ end
35
+
36
+ class WriteTimeoutError < RequestTimeoutError
37
+ end
38
+
26
39
  class ResolveError < Error
27
40
  end
28
41
 
data/sig/io.rbs ADDED
@@ -0,0 +1,6 @@
1
+ module HTTPX
2
+ type io_type = "udp" | "tcp" | "ssl" | "unix"
3
+
4
+ module IO
5
+ end
6
+ end
data/sig/options.rbs CHANGED
@@ -10,7 +10,7 @@ module HTTPX
10
10
  SETTINGS_TIMEOUT: Integer
11
11
  DEFAULT_OPTIONS: Hash[Symbol, untyped]
12
12
 
13
- type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :total_timeout
13
+ type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :total_timeout | :read_timeout | :write_timeout | :request_timeout
14
14
  type timeout = Hash[timeout_type, Numeric]
15
15
 
16
16
  def self.new: (?options) -> instance
@@ -65,6 +65,9 @@ module HTTPX
65
65
  # body
66
66
  attr_reader origin: URI::Generic?
67
67
 
68
+ # base_path
69
+ attr_reader base_path: String?
70
+
68
71
  # ssl
69
72
 
70
73
  # http2_settings
@@ -0,0 +1,61 @@
1
+ module HTTPX
2
+ module Plugins
3
+ module CircuitBreaker
4
+
5
+ class CircuitStore
6
+ @circuits: Hash[String, Circuit]
7
+
8
+ def try_open: (generic_uri uri, response response) -> void
9
+
10
+ def try_respond: (Request request) -> response?
11
+
12
+ private
13
+
14
+ def get_circuit_for_uri: (generic_uri uri) -> Circuit
15
+
16
+ def initialize: (Options & _CircuitOptions options) -> void
17
+ end
18
+
19
+ class Circuit
20
+ @state: :closed | :open | :half_open
21
+ @max_attempts: Integer
22
+ @reset_attempts_in: Float
23
+ @break_in: Float
24
+ @circuit_breaker_half_open_drip_rate: Float
25
+ @attempts: Integer
26
+
27
+ @response: response?
28
+ @opened_at: Float?
29
+ @attempted_at: Float?
30
+
31
+ def respond: () -> response?
32
+
33
+ def try_open: (response) -> void
34
+
35
+ def try_close: () -> void
36
+
37
+ private
38
+
39
+ def initialize: (Integer max_attempts, Float reset_attempts_in, Float break_in, Float circuit_breaker_half_open_drip_rate) -> void
40
+ end
41
+
42
+ interface _CircuitOptions
43
+ def circuit_breaker_max_attempts: () -> Integer
44
+ def circuit_breaker_reset_attempts_in: () -> Float
45
+ def circuit_breaker_break_in: () -> Float
46
+ def circuit_breaker_half_open_drip_rate: () -> Float
47
+ def circuit_breaker_break_on: () -> (^(Response) -> boolish | nil)
48
+ end
49
+
50
+ def self.load_dependencies: (singleton(Session)) -> void
51
+ def self.extra_options: (Options) -> (Options & _CircuitOptions)
52
+
53
+ module InstanceMethods
54
+ @circuit_store: CircuitStore
55
+ end
56
+
57
+ end
58
+
59
+ type sessionCircuitBreaker = Session & CircuitBreaker::InstanceMethods
60
+ end
61
+ end
@@ -6,7 +6,7 @@ module HTTPX
6
6
  def self.configure: (singleton(Session)) -> void
7
7
 
8
8
  def self?.deflater: () -> _Deflater
9
- def self?.decoder: (Numeric bytesize) -> Inflater
9
+ def self?.decoder: (Integer | Float bytesize) -> Inflater
10
10
 
11
11
  module Deflater
12
12
  extend _Deflater
@@ -6,7 +6,7 @@ module HTTPX
6
6
  def self.configure: (singleton(Session)) -> void
7
7
 
8
8
  def self?.deflater: () -> _Deflater
9
- def self?.inflater: (Numeric bytesize) -> GZIP::Inflater
9
+ def self?.inflater: (Integer | Float bytesize) -> GZIP::Inflater
10
10
 
11
11
  module Deflater
12
12
  extend _Deflater
@@ -6,15 +6,15 @@ module HTTPX
6
6
  def self.configure: (singleton(Session)) -> void
7
7
 
8
8
  def self?.deflater: () -> _Deflater
9
- def self?.inflater: (Numeric bytesize) -> Inflater
9
+ def self?.inflater: (Integer | Float bytesize) -> Inflater
10
10
 
11
11
  class Deflater
12
12
  include _Deflater
13
13
 
14
14
  @compressed_chunk: String
15
-
15
+
16
16
  private
17
-
17
+
18
18
  def initialize: () -> untyped
19
19
  def write: (string) -> void
20
20
  def compressed_chunk: () -> String
@@ -13,7 +13,7 @@ module HTTPX
13
13
  interface _Inflater
14
14
  def inflate: (string) -> String
15
15
 
16
- def initialize: (Numeric bytesize) -> untyped
16
+ def initialize: (Integer | Float bytesize) -> untyped
17
17
  end
18
18
 
19
19
  def self.configure: (singleton(Session)) -> void
@@ -61,7 +61,7 @@ module HTTPX
61
61
  @boundary: String
62
62
  @intermediate_boundary: String
63
63
 
64
- def call: (Response response, untyped) -> Hash[String, untyped]
64
+ def call: (Response response, *untyped) -> Hash[String, untyped]
65
65
 
66
66
  private
67
67
 
@@ -4,14 +4,15 @@ module HTTPX
4
4
  module Plugins
5
5
  module Proxy
6
6
  module Socks5
7
-
7
+ VERSION: Integer
8
+
8
9
  module ConnectionMethods
9
10
  def __socks5_proxy_connect: () -> void
10
11
  def __socks5_on_packet: (String packet) -> void
11
12
  def __socks5_check_version: (int) -> void
12
13
  def __on_socks5_error: (string) -> void
13
14
  end
14
-
15
+
15
16
  class SocksParser
16
17
  include Callbacks
17
18
 
@@ -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
@@ -8,15 +8,19 @@ module HTTPX
8
8
  def self?.cached_response?: (response response) -> bool
9
9
 
10
10
  class Store
11
- @store: Hash[URI::Generic, Response]
11
+ @store: Hash[String, Array[Response]]
12
12
 
13
- def lookup: (URI::Generic uri) -> Response?
13
+ def lookup: (Request request) -> Response?
14
14
 
15
- def cached?: (URI::Generic uri) -> bool
15
+ def cached?: (Request request) -> boolish
16
16
 
17
- def cache: (URI::Generic uri, Response response) -> void
17
+ def cache: (Request request, Response response) -> void
18
18
 
19
19
  def prepare: (Request request) -> void
20
+
21
+ private
22
+
23
+ def match_by_vary?: (Request request, Response response) -> bool
20
24
  end
21
25
 
22
26
  module InstanceMethods
@@ -25,8 +29,24 @@ module HTTPX
25
29
  def clear_response_cache: () -> void
26
30
  end
27
31
 
32
+ module RequestMethods
33
+ def response_cache_key: () -> String
34
+ end
35
+
28
36
  module ResponseMethods
29
37
  def copy_from_cached: (Response other) -> void
38
+
39
+ def fresh?: () -> bool
40
+
41
+ def cache_control: () -> Array[String]?
42
+
43
+ def vary: () -> Array[String]?
44
+
45
+ private
46
+
47
+ def age: () -> Integer
48
+
49
+ def date: () -> Time
30
50
  end
31
51
  end
32
52
 
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
@@ -96,6 +98,7 @@ module HTTPX
96
98
  class ErrorResponse
97
99
  include _Response
98
100
  include Loggable
101
+ extend Forwardable
99
102
 
100
103
  @options: Options
101
104
  @error: Exception
@@ -104,6 +107,8 @@ module HTTPX
104
107
 
105
108
  def status: () -> (Integer | _ToS)
106
109
 
110
+ def uri: () -> URI::Generic
111
+
107
112
  private
108
113
 
109
114
  def initialize: (Request, Exception, options) -> untyped
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