httpx 0.15.3 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_15_4.md +5 -0
  3. data/doc/release_notes/0_16_0.md +93 -0
  4. data/doc/release_notes/0_16_1.md +5 -0
  5. data/doc/release_notes/0_17_0.md +49 -0
  6. data/lib/httpx/adapters/faraday.rb +3 -11
  7. data/lib/httpx/adapters/webmock.rb +2 -2
  8. data/lib/httpx/buffer.rb +1 -1
  9. data/lib/httpx/callbacks.rb +1 -1
  10. data/lib/httpx/chainable.rb +15 -8
  11. data/lib/httpx/connection/http1.rb +18 -10
  12. data/lib/httpx/connection/http2.rb +14 -21
  13. data/lib/httpx/connection.rb +6 -7
  14. data/lib/httpx/errors.rb +11 -11
  15. data/lib/httpx/headers.rb +1 -1
  16. data/lib/httpx/io/ssl.rb +2 -2
  17. data/lib/httpx/io/tls.rb +1 -1
  18. data/lib/httpx/options.rb +108 -81
  19. data/lib/httpx/parser/http1.rb +11 -7
  20. data/lib/httpx/plugins/aws_sigv4.rb +10 -9
  21. data/lib/httpx/plugins/compression.rb +12 -11
  22. data/lib/httpx/plugins/cookies/cookie.rb +4 -2
  23. data/lib/httpx/plugins/cookies/jar.rb +20 -1
  24. data/lib/httpx/plugins/cookies.rb +20 -7
  25. data/lib/httpx/plugins/digest_authentication.rb +19 -15
  26. data/lib/httpx/plugins/expect.rb +19 -15
  27. data/lib/httpx/plugins/follow_redirects.rb +9 -9
  28. data/lib/httpx/plugins/grpc/call.rb +4 -1
  29. data/lib/httpx/plugins/grpc.rb +73 -47
  30. data/lib/httpx/plugins/h2c.rb +7 -3
  31. data/lib/httpx/plugins/multipart/decoder.rb +187 -0
  32. data/lib/httpx/plugins/multipart/mime_type_detector.rb +3 -3
  33. data/lib/httpx/plugins/multipart/part.rb +2 -2
  34. data/lib/httpx/plugins/multipart.rb +14 -0
  35. data/lib/httpx/plugins/ntlm_authentication.rb +12 -10
  36. data/lib/httpx/plugins/proxy/socks4.rb +2 -1
  37. data/lib/httpx/plugins/proxy/socks5.rb +2 -1
  38. data/lib/httpx/plugins/proxy/ssh.rb +20 -13
  39. data/lib/httpx/plugins/proxy.rb +10 -10
  40. data/lib/httpx/plugins/retries.rb +25 -21
  41. data/lib/httpx/plugins/stream.rb +2 -3
  42. data/lib/httpx/plugins/upgrade.rb +7 -6
  43. data/lib/httpx/registry.rb +2 -2
  44. data/lib/httpx/request.rb +10 -19
  45. data/lib/httpx/resolver/https.rb +0 -2
  46. data/lib/httpx/resolver/native.rb +15 -3
  47. data/lib/httpx/resolver/resolver_mixin.rb +2 -1
  48. data/lib/httpx/response.rb +72 -38
  49. data/lib/httpx/selector.rb +6 -7
  50. data/lib/httpx/session.rb +34 -21
  51. data/lib/httpx/session2.rb +23 -0
  52. data/lib/httpx/transcoder/body.rb +1 -1
  53. data/lib/httpx/transcoder/chunker.rb +2 -1
  54. data/lib/httpx/transcoder/form.rb +20 -0
  55. data/lib/httpx/transcoder/json.rb +12 -0
  56. data/lib/httpx/transcoder.rb +62 -1
  57. data/lib/httpx/utils.rb +2 -2
  58. data/lib/httpx/version.rb +1 -1
  59. data/lib/httpx.rb +6 -3
  60. data/sig/buffer.rbs +3 -1
  61. data/sig/chainable.rbs +30 -29
  62. data/sig/connection/http1.rbs +11 -5
  63. data/sig/connection/http2.rbs +16 -5
  64. data/sig/connection.rbs +23 -11
  65. data/sig/errors.rbs +35 -1
  66. data/sig/headers.rbs +20 -19
  67. data/sig/httpx.rbs +4 -1
  68. data/sig/loggable.rbs +3 -1
  69. data/sig/options.rbs +45 -34
  70. data/sig/parser/http1.rbs +3 -3
  71. data/sig/plugins/authentication.rbs +1 -1
  72. data/sig/plugins/aws_sdk_authentication.rbs +5 -1
  73. data/sig/plugins/aws_sigv4.rbs +13 -5
  74. data/sig/plugins/basic_authentication.rbs +1 -1
  75. data/sig/plugins/compression.rbs +4 -6
  76. data/sig/plugins/cookies/cookie.rbs +5 -7
  77. data/sig/plugins/cookies/jar.rbs +9 -10
  78. data/sig/plugins/cookies.rbs +4 -5
  79. data/sig/plugins/digest_authentication.rbs +2 -3
  80. data/sig/plugins/expect.rbs +2 -4
  81. data/sig/plugins/follow_redirects.rbs +3 -5
  82. data/sig/plugins/grpc.rbs +4 -7
  83. data/sig/plugins/h2c.rbs +0 -2
  84. data/sig/plugins/multipart.rbs +64 -10
  85. data/sig/plugins/ntlm_authentication.rbs +2 -3
  86. data/sig/plugins/persistent.rbs +3 -8
  87. data/sig/plugins/proxy/ssh.rbs +4 -4
  88. data/sig/plugins/proxy.rbs +13 -13
  89. data/sig/plugins/push_promise.rbs +0 -2
  90. data/sig/plugins/retries.rbs +4 -8
  91. data/sig/plugins/stream.rbs +1 -1
  92. data/sig/plugins/upgrade.rbs +2 -3
  93. data/sig/pool.rbs +1 -2
  94. data/sig/registry.rbs +1 -1
  95. data/sig/request.rbs +11 -8
  96. data/sig/resolver/native.rbs +12 -6
  97. data/sig/resolver/resolver_mixin.rbs +4 -5
  98. data/sig/resolver/system.rbs +2 -0
  99. data/sig/resolver.rbs +7 -0
  100. data/sig/response.rbs +24 -12
  101. data/sig/selector.rbs +11 -9
  102. data/sig/session.rbs +22 -23
  103. data/sig/transcoder/body.rbs +6 -1
  104. data/sig/transcoder/chunker.rbs +8 -2
  105. data/sig/transcoder/form.rbs +3 -1
  106. data/sig/transcoder/json.rbs +2 -0
  107. data/sig/transcoder.rbs +13 -5
  108. data/sig/utils.rbs +2 -0
  109. metadata +12 -2
data/sig/selector.rbs CHANGED
@@ -1,20 +1,22 @@
1
1
  module HTTPX
2
2
  class Selector
3
- READABLE: :r | :rw
4
- WRITABLE: :w | :rw
5
- @selectables: Array[_ToIO]
3
+ type selectable = Connection | Resolver::Native | Resolver::HTTPS
6
4
 
7
- def register: (_ToIO) -> void
8
- def deregister: (_ToIO) -> void
5
+ READABLE: Array[Symbol]
6
+ WRITABLE: Array[Symbol]
7
+ @selectables: Array[selectable]
8
+
9
+ def register: (selectable) -> void
10
+ def deregister: (selectable) -> void
11
+
12
+ def select: (Numeric? interval) { (selectable) -> void } -> void
9
13
 
10
- def select: (Numeric?) { (_ToIO) -> void } -> void
11
-
12
14
  private
13
15
 
14
16
  def initialize: () -> untyped
15
17
 
16
- def select_many: (Numeric?) { (_ToIO) -> void } -> void
17
- def select_one: (Numeric?) { (_ToIO) -> void } -> void
18
+ def select_many: (Numeric? interval) { (selectable) -> void } -> void
19
+ def select_one: (Numeric? interval) { (selectable) -> void } -> void
18
20
  end
19
21
 
20
22
  type io_interests = :r | :w | :rw
data/sig/session.rbs CHANGED
@@ -3,51 +3,50 @@ module HTTPX
3
3
  include Loggable
4
4
  include Chainable
5
5
 
6
- @options: Options
7
- @responses: Hash[Request, Response]
8
- @persistent: bool
9
-
10
- def wrap: () { (instance) -> void } -> void
11
- | () -> void
12
- def close: (*untyped) -> void
6
+ EMPTY_HASH: Hash[untyped, untyped]
13
7
 
14
- def request: (*Request, **untyped) -> (response | Array[response])
15
- | (*untyped, **untyped) -> (response | Array[response])
8
+ @options: Options
9
+ @responses: Hash[Request, response]
10
+ @persistent: bool?
16
11
 
17
- def build_request: (String | verb, uri, ?options) -> Request
12
+ def self.plugin: (Symbol | Module plugin, ?options? options) ?{ (Class) -> void } -> singleton(Session)
18
13
 
19
- def self.plugin: (Symbol | Module, ?options) { (Class) -> void } -> singleton(Session)
20
- | (Symbol | Module, ?options) -> singleton(Session)
14
+ def self.default_options: -> Options
21
15
 
16
+ def wrap: () { (instance) -> void } -> void
22
17
 
18
+ def close: (*untyped) -> void
23
19
 
24
- def self.default_options: -> Options
20
+ def build_request: (String | verb, generic_uri, ?options) -> Request
25
21
 
26
22
  private
27
23
 
28
- def initialize: (?options?) { (instance) -> void } -> untyped
29
- | (?options?) -> untyped
24
+ def initialize: (?options) { (self) -> void } -> untyped
25
+ | (?options) -> untyped
30
26
 
31
27
  def pool: -> Pool
32
28
  def on_response: (Request, response) -> void
33
29
  def on_promise: (untyped, untyped) -> void
34
- def fetch_response: (Request, *untyped) -> response?
30
+ def fetch_response: (Request request, untyped, untyped) -> response?
31
+
32
+ def find_connection: (Request, Array[Connection] connections, Options options) -> Connection
33
+
35
34
  def set_connection_callbacks: (Connection, Array[Connection], Options) -> void
36
35
 
37
- def build_altsvc_connection: (Connection, Array[Connection], URI, String, Hash[String, String], Options) -> Connection?
36
+ def build_altsvc_connection: (Connection, Array[Connection], URI::Generic, String, Hash[String, String], Options) -> Connection?
38
37
 
39
38
  def build_requests: (verb | string, uri, options) -> Array[Request]
40
39
  | (Array[[verb | string, uri, options]], options) -> Array[Request]
41
40
  | (Array[[verb | string, uri]], options) -> Array[Request]
42
- | (verb | string, _Each[[uri, options], void], Options) -> Array[Request]
43
- | (verb | string, _Each[uri, void], options) -> Array[Request]
41
+ | (verb | string, _Each[[uri, options]], Options) -> Array[Request]
42
+ | (verb | string, _Each[uri], options) -> Array[Request]
44
43
 
45
- def build_connection: (URI, Options) -> Connection
44
+ def build_connection: (URI::Generic, Options) -> Connection
46
45
 
47
- def send_requests: (*Request, options) -> Array[response]
46
+ def send_requests: (*Request) -> Array[response]
48
47
 
49
- def _send_requests: (Array[Request], options) -> Array[Connection]
48
+ def _send_requests: (Array[Request]) -> Array[Connection]
50
49
 
51
- def receive_requests: (Array[Request], Array[Connection], options) -> Array[response]
50
+ def receive_requests: (Array[Request], Array[Connection]) -> Array[response]
52
51
  end
53
52
  end
@@ -1,7 +1,12 @@
1
1
  module HTTPX
2
2
  module Transcoder
3
3
  module Body
4
+ class Error < HTTPX::Error
5
+ end
6
+
4
7
  class Encoder
8
+ extend Forwardable
9
+
5
10
  include _Encoder
6
11
  include _ToS
7
12
 
@@ -11,7 +16,7 @@ module HTTPX
11
16
 
12
17
  private
13
18
 
14
- def initialize: (untyped body ) -> untyped
19
+ def initialize: (untyped body) -> untyped
15
20
  end
16
21
 
17
22
  def self?.encode: (bodyIO body) -> Encoder
@@ -1,6 +1,11 @@
1
1
  module HTTPX::Transcoder
2
2
  module Chunker
3
- def self?.encode: (_Encoder chunks) -> Encoder
3
+ CRLF: String
4
+
5
+ class Error < HTTPX::Error
6
+ end
7
+
8
+ def self?.encode: (_Each[String] chunks) -> Encoder
4
9
 
5
10
  class Encoder
6
11
  @raw: _Each[String]
@@ -9,10 +14,11 @@ module HTTPX::Transcoder
9
14
 
10
15
  private
11
16
 
12
- def initialize: (_Encoder chunks) -> untyped
17
+ def initialize: (_Each[String] chunks) -> untyped
13
18
  end
14
19
 
15
20
  class Decoder
21
+ extend Forwardable
16
22
  include _ToS
17
23
  include _Each[String]
18
24
 
@@ -3,12 +3,14 @@ module HTTPX::Transcoder
3
3
 
4
4
  type form_nested_value = form_value | _ToAry[form_value] | _ToHash[string, form_value]
5
5
 
6
- type urlencoded_input = Enumerable[[string, form_nested_value], untyped]
6
+ type urlencoded_input = Enumerable[[_ToS, form_nested_value]]
7
7
 
8
8
  module Form
9
9
  def self?.encode: (urlencoded_input form) -> Encoder
10
+ def self?.decode: (HTTPX::Response response) -> _Decoder
10
11
 
11
12
  class Encoder
13
+ extend Forwardable
12
14
  include _Encoder
13
15
  include _ToS
14
16
 
@@ -1,8 +1,10 @@
1
1
  module HTTPX::Transcoder
2
2
  module JSON
3
3
  def self?.encode: (_ToJson json) -> Encoder
4
+ def self?.decode: (HTTPX::Response response) -> _Decoder
4
5
 
5
6
  class Encoder
7
+ extend Forwardable
6
8
  include _Encoder
7
9
  include _ToS
8
10
 
data/sig/transcoder.rbs CHANGED
@@ -1,18 +1,26 @@
1
1
  module HTTPX
2
- type bodyIO = _Reader | _Each[String, untyped] | _ToS
2
+ type bodyIO = _Reader | _Each[[String, untyped]] | _ToS
3
3
 
4
4
  module Transcoder
5
- extend HTTPX::Registry[String, Class]
5
+ def self?.registry: (String tag) -> _Encode
6
+ | () -> Hash[String, _Encode]
6
7
 
7
- def self.normalize_keys: (string | Symbol, top, ?Proc?) { (string, top) -> void } -> void
8
- | (string | Symbol, top, ?Proc?) { (string) -> void } -> void
8
+ def self?.register: (String tag, _Encode handler) -> void
9
+
10
+ def self?.normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value, ?(^(untyped value) -> bool | nil) cond) { (String, ?untyped) -> U } -> U
11
+
12
+ def self?.normalize_query: (Hash[String, untyped] params, String name, String v, Integer depth) -> void
13
+
14
+ interface _Encode
15
+ def encode: (untyped payload) -> (_Encoder | _Each[String])
16
+ end
9
17
 
10
18
  interface _Encoder
11
19
  def bytesize: () -> Numeric
12
20
  end
13
21
 
14
22
  interface _Decoder
15
- def decode: (string) -> String
23
+ def call: (Response response, untyped options) -> untyped
16
24
  end
17
25
  end
18
26
  end
data/sig/utils.rbs CHANGED
@@ -1,5 +1,7 @@
1
1
  module HTTPX
2
2
  module Utils
3
+ URIParser: URI::RFC2396_Parser
4
+
3
5
  def self?.parse_retry_after: (String) -> Numeric
4
6
 
5
7
  def self?.to_uri: (generic_uri uri) -> URI::Generic
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.15.3
4
+ version: 0.17.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: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2021-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -72,6 +72,10 @@ extra_rdoc_files:
72
72
  - doc/release_notes/0_15_1.md
73
73
  - doc/release_notes/0_15_2.md
74
74
  - doc/release_notes/0_15_3.md
75
+ - doc/release_notes/0_15_4.md
76
+ - doc/release_notes/0_16_0.md
77
+ - doc/release_notes/0_16_1.md
78
+ - doc/release_notes/0_17_0.md
75
79
  - doc/release_notes/0_1_0.md
76
80
  - doc/release_notes/0_2_0.md
77
81
  - doc/release_notes/0_2_1.md
@@ -123,6 +127,10 @@ files:
123
127
  - doc/release_notes/0_15_1.md
124
128
  - doc/release_notes/0_15_2.md
125
129
  - doc/release_notes/0_15_3.md
130
+ - doc/release_notes/0_15_4.md
131
+ - doc/release_notes/0_16_0.md
132
+ - doc/release_notes/0_16_1.md
133
+ - doc/release_notes/0_17_0.md
126
134
  - doc/release_notes/0_1_0.md
127
135
  - doc/release_notes/0_2_0.md
128
136
  - doc/release_notes/0_2_1.md
@@ -193,6 +201,7 @@ files:
193
201
  - lib/httpx/plugins/h2c.rb
194
202
  - lib/httpx/plugins/internal_telemetry.rb
195
203
  - lib/httpx/plugins/multipart.rb
204
+ - lib/httpx/plugins/multipart/decoder.rb
196
205
  - lib/httpx/plugins/multipart/encoder.rb
197
206
  - lib/httpx/plugins/multipart/mime_type_detector.rb
198
207
  - lib/httpx/plugins/multipart/part.rb
@@ -222,6 +231,7 @@ files:
222
231
  - lib/httpx/response.rb
223
232
  - lib/httpx/selector.rb
224
233
  - lib/httpx/session.rb
234
+ - lib/httpx/session2.rb
225
235
  - lib/httpx/transcoder.rb
226
236
  - lib/httpx/transcoder/body.rb
227
237
  - lib/httpx/transcoder/chunker.rb