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
@@ -43,9 +43,6 @@ class HTTPX::Selector
43
43
 
44
44
  private
45
45
 
46
- READ_INTERESTS = %i[r rw].freeze
47
- WRITE_INTERESTS = %i[w rw].freeze
48
-
49
46
  def select_many(interval, &block)
50
47
  selectables, r, w = nil
51
48
 
@@ -64,8 +61,8 @@ class HTTPX::Selector
64
61
  selectables.each do |io|
65
62
  interests = io.interests
66
63
 
67
- (r ||= []) << io if READ_INTERESTS.include?(interests)
68
- (w ||= []) << io if WRITE_INTERESTS.include?(interests)
64
+ (r ||= []) << io if READABLE.include?(interests)
65
+ (w ||= []) << io if WRITABLE.include?(interests)
69
66
  end
70
67
 
71
68
  if @selectables.empty?
@@ -89,7 +86,7 @@ class HTTPX::Selector
89
86
 
90
87
  readers, writers = IO.select(r, w, nil, interval)
91
88
 
92
- raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") if readers.nil? && writers.nil?
89
+ raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") if readers.nil? && writers.nil? && interval
93
90
  rescue IOError, SystemCallError
94
91
  @selectables.reject!(&:closed?)
95
92
  retry
@@ -112,6 +109,8 @@ class HTTPX::Selector
112
109
  def select_one(interval)
113
110
  io = @selectables.first
114
111
 
112
+ return unless io
113
+
115
114
  interests = io.interests
116
115
 
117
116
  result = case interests
@@ -121,7 +120,7 @@ class HTTPX::Selector
121
120
  when nil then return
122
121
  end
123
122
 
124
- raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") unless result
123
+ raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") unless result || interval.nil?
125
124
 
126
125
  yield io
127
126
  rescue IOError, SystemCallError
data/lib/httpx/session.rb CHANGED
@@ -15,8 +15,6 @@ module HTTPX
15
15
  end
16
16
 
17
17
  def wrap
18
- return unless block_given?
19
-
20
18
  begin
21
19
  prev_persistent = @persistent
22
20
  @persistent = true
@@ -31,8 +29,10 @@ module HTTPX
31
29
  end
32
30
 
33
31
  def request(*args, **options)
32
+ raise ArgumentError, "must perform at least one request" if args.empty?
33
+
34
34
  requests = args.first.is_a?(Request) ? args : build_requests(*args, options)
35
- responses = send_requests(*requests, options)
35
+ responses = send_requests(*requests)
36
36
  return responses.first if responses.size == 1
37
37
 
38
38
  responses
@@ -40,7 +40,8 @@ module HTTPX
40
40
 
41
41
  def build_request(verb, uri, options = EMPTY_HASH)
42
42
  rklass = @options.request_class
43
- request = rklass.new(verb, uri, @options.merge(options).merge(persistent: @persistent))
43
+ options = @options.merge(options) unless options.is_a?(Options)
44
+ request = rklass.new(verb, uri, options.merge(persistent: @persistent))
44
45
  request.on(:response, &method(:on_response).curry(2)[request])
45
46
  request.on(:promise, &method(:on_promise))
46
47
  request
@@ -174,37 +175,38 @@ module HTTPX
174
175
  end
175
176
  end
176
177
 
177
- def send_requests(*requests, options)
178
- request_options = @options.merge(options)
179
-
180
- connections = _send_requests(requests, request_options)
181
- receive_requests(requests, connections, request_options)
178
+ def send_requests(*requests)
179
+ connections = _send_requests(requests)
180
+ receive_requests(requests, connections)
182
181
  end
183
182
 
184
- def _send_requests(requests, options)
183
+ def _send_requests(requests)
185
184
  connections = []
186
185
 
187
186
  requests.each do |request|
188
187
  error = catch(:resolve_error) do
189
- connection = find_connection(request, connections, options)
188
+ connection = find_connection(request, connections, request.options)
190
189
  connection.send(request)
191
190
  end
192
191
  next unless error.is_a?(ResolveError)
193
192
 
194
- request.emit(:response, ErrorResponse.new(request, error, options))
193
+ request.emit(:response, ErrorResponse.new(request, error, request.options))
195
194
  end
196
195
 
197
196
  connections
198
197
  end
199
198
 
200
- def receive_requests(requests, connections, options)
199
+ def receive_requests(requests, connections)
201
200
  responses = []
202
201
 
203
202
  begin
204
203
  # guarantee ordered responses
205
204
  loop do
206
205
  request = requests.first
207
- pool.next_tick until (response = fetch_response(request, connections, options))
206
+
207
+ return responses unless request
208
+
209
+ pool.next_tick until (response = fetch_response(request, connections, request.options))
208
210
 
209
211
  responses << response
210
212
  requests.shift
@@ -218,7 +220,7 @@ module HTTPX
218
220
  # opportunity to traverse the requests, hence we're returning only a fraction of the errors
219
221
  # we were supposed to. This effectively fetches the existing responses and return them.
220
222
  while (request = requests.shift)
221
- responses << fetch_response(request, connections, options)
223
+ responses << fetch_response(request, connections, request.options)
222
224
  end
223
225
  break
224
226
  end
@@ -247,9 +249,8 @@ module HTTPX
247
249
  if !@plugins.include?(pl)
248
250
  @plugins << pl
249
251
  pl.load_dependencies(self, &block) if pl.respond_to?(:load_dependencies)
252
+
250
253
  @default_options = @default_options.dup
251
- @default_options = pl.extra_options(@default_options, &block) if pl.respond_to?(:extra_options)
252
- @default_options = @default_options.merge(options) if options
253
254
 
254
255
  include(pl::InstanceMethods) if defined?(pl::InstanceMethods)
255
256
  extend(pl::ClassMethods) if defined?(pl::ClassMethods)
@@ -266,14 +267,26 @@ module HTTPX
266
267
  opts.response_body_class.__send__(:include, pl::ResponseBodyMethods) if defined?(pl::ResponseBodyMethods)
267
268
  opts.response_body_class.extend(pl::ResponseBodyClassMethods) if defined?(pl::ResponseBodyClassMethods)
268
269
  opts.connection_class.__send__(:include, pl::ConnectionMethods) if defined?(pl::ConnectionMethods)
270
+ if defined?(pl::OptionsMethods)
271
+ opts.options_class.__send__(:include, pl::OptionsMethods)
272
+
273
+ (pl::OptionsMethods.instance_methods - Object.instance_methods).each do |meth|
274
+ opts.options_class.method_added(meth)
275
+ end
276
+ @default_options = opts.options_class.new(opts)
277
+ end
278
+
279
+ @default_options = pl.extra_options(@default_options) if pl.respond_to?(:extra_options)
280
+ @default_options = @default_options.merge(options) if options
281
+
269
282
  pl.configure(self, &block) if pl.respond_to?(:configure)
270
283
 
271
284
  @default_options.freeze
272
285
  elsif options
273
286
  # this can happen when two plugins are loaded, an one of them calls the other under the hood,
274
287
  # albeit changing some default.
275
- @default_options = @default_options.dup
276
- @default_options = @default_options.merge(options)
288
+ @default_options = pl.extra_options(@default_options) if pl.respond_to?(:extra_options)
289
+ @default_options = @default_options.merge(options) if options
277
290
 
278
291
  @default_options.freeze
279
292
  end
@@ -283,8 +296,8 @@ module HTTPX
283
296
  # :nocov:
284
297
  def plugins(pls)
285
298
  warn ":#{__method__} is deprecated, use :plugin instead"
286
- pls.each do |pl, *args|
287
- plugin(pl, *args)
299
+ pls.each do |pl|
300
+ plugin(pl)
288
301
  end
289
302
  self
290
303
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "session"
4
+ module HTTPX
5
+ class Session
6
+ def initialize(options = EMPTY_HASH, &blk)
7
+ @options = self.class.default_options.merge(options)
8
+ @responses = {}
9
+ @persistent = @options.persistent
10
+ wrap(&blk) if block_given?
11
+ end
12
+
13
+ def wrap
14
+ begin
15
+ prev_persistent = @persistent
16
+ @persistent = true
17
+ yield self
18
+ ensure
19
+ @persistent = prev_persistent
20
+ end
21
+ end
22
+ end
23
+ end
@@ -4,7 +4,7 @@ require "forwardable"
4
4
 
5
5
  module HTTPX::Transcoder
6
6
  module Body
7
- Error = Class.new(HTTPX::Error)
7
+ class Error < HTTPX::Error; end
8
8
 
9
9
  module_function
10
10
 
@@ -4,7 +4,8 @@ require "forwardable"
4
4
 
5
5
  module HTTPX::Transcoder
6
6
  module Chunker
7
- Error = Class.new(HTTPX::Error)
7
+ class Error < HTTPX::Error; end
8
+
8
9
  CRLF = "\r\n".b
9
10
 
10
11
  class Encoder
@@ -7,6 +7,8 @@ module HTTPX::Transcoder
7
7
  module Form
8
8
  module_function
9
9
 
10
+ PARAM_DEPTH_LIMIT = 32
11
+
10
12
  class Encoder
11
13
  extend Forwardable
12
14
 
@@ -31,9 +33,27 @@ module HTTPX::Transcoder
31
33
  end
32
34
  end
33
35
 
36
+ module Decoder
37
+ module_function
38
+
39
+ def call(response, _)
40
+ URI.decode_www_form(response.to_s).each_with_object({}) do |(field, value), params|
41
+ HTTPX::Transcoder.normalize_query(params, field, value, PARAM_DEPTH_LIMIT)
42
+ end
43
+ end
44
+ end
45
+
34
46
  def encode(form)
35
47
  Encoder.new(form)
36
48
  end
49
+
50
+ def decode(response)
51
+ content_type = response.content_type.mime_type
52
+
53
+ raise Error, "invalid form mime type (#{content_type})" unless content_type == "application/x-www-form-urlencoded"
54
+
55
+ Decoder
56
+ end
37
57
  end
38
58
  register "form", Form
39
59
  end
@@ -5,6 +5,10 @@ require "json"
5
5
 
6
6
  module HTTPX::Transcoder
7
7
  module JSON
8
+ JSON_REGEX = %r{\bapplication/(?:vnd\.api\+)?json\b}i.freeze
9
+
10
+ using HTTPX::RegexpExtensions unless Regexp.method_defined?(:match?)
11
+
8
12
  module_function
9
13
 
10
14
  class Encoder
@@ -27,6 +31,14 @@ module HTTPX::Transcoder
27
31
  def encode(json)
28
32
  Encoder.new(json)
29
33
  end
34
+
35
+ def decode(response)
36
+ content_type = response.content_type.mime_type
37
+
38
+ raise Error, "invalid json mime type (#{content_type})" unless JSON_REGEX.match?(content_type)
39
+
40
+ ::JSON.method(:parse)
41
+ end
30
42
  end
31
43
  register "json", JSON
32
44
  end
@@ -4,7 +4,11 @@ module HTTPX
4
4
  module Transcoder
5
5
  extend Registry
6
6
 
7
- def self.normalize_keys(key, value, cond = nil, &block)
7
+ using RegexpExtensions unless Regexp.method_defined?(:match?)
8
+
9
+ module_function
10
+
11
+ def normalize_keys(key, value, cond = nil, &block)
8
12
  if (cond && cond.call(value))
9
13
  block.call(key.to_s, value)
10
14
  elsif value.respond_to?(:to_ary)
@@ -23,6 +27,63 @@ module HTTPX
23
27
  block.call(key.to_s, value)
24
28
  end
25
29
  end
30
+
31
+ # based on https://github.com/rack/rack/blob/d15dd728440710cfc35ed155d66a98dc2c07ae42/lib/rack/query_parser.rb#L82
32
+ def normalize_query(params, name, v, depth)
33
+ raise Error, "params depth surpasses what's supported" if depth <= 0
34
+
35
+ name =~ /\A[\[\]]*([^\[\]]+)\]*/
36
+ k = Regexp.last_match(1) || ""
37
+ after = Regexp.last_match ? Regexp.last_match.post_match : ""
38
+
39
+ if k.empty?
40
+ return Array(v) if !v.empty? && name == "[]"
41
+
42
+ return
43
+ end
44
+
45
+ case after
46
+ when ""
47
+ params[k] = v
48
+ when "["
49
+ params[name] = v
50
+ when "[]"
51
+ params[k] ||= []
52
+ raise Error, "expected Array (got #{params[k].class}) for param '#{k}'" unless params[k].is_a?(Array)
53
+
54
+ params[k] << v
55
+ when /^\[\]\[([^\[\]]+)\]$/, /^\[\](.+)$/
56
+ child_key = Regexp.last_match(1)
57
+ params[k] ||= []
58
+ raise Error, "expected Array (got #{params[k].class}) for param '#{k}'" unless params[k].is_a?(Array)
59
+
60
+ if params[k].last.is_a?(Hash) && !params_hash_has_key?(params[k].last, child_key)
61
+ normalize_query(params[k].last, child_key, v, depth - 1)
62
+ else
63
+ params[k] << normalize_query({}, child_key, v, depth - 1)
64
+ end
65
+ else
66
+ params[k] ||= {}
67
+ raise Error, "expected Hash (got #{params[k].class}) for param '#{k}'" unless params[k].is_a?(Hash)
68
+
69
+ params[k] = normalize_query(params[k], after, v, depth - 1)
70
+ end
71
+
72
+ params
73
+ end
74
+
75
+ def params_hash_has_key?(hash, key)
76
+ return false if /\[\]/.match?(key)
77
+
78
+ key.split(/[\[\]]+/).inject(hash) do |h, part|
79
+ next h if part == ""
80
+ return false unless h.is_a?(Hash) && h.key?(part)
81
+
82
+ h[part]
83
+ end
84
+
85
+ true
86
+ end
26
87
  end
27
88
  end
28
89
 
data/lib/httpx/utils.rb CHANGED
@@ -28,9 +28,9 @@ module HTTPX
28
28
  URIParser = URI::RFC2396_Parser.new
29
29
 
30
30
  def to_uri(uri)
31
- return Kernel.URI(uri) unless uri.is_a?(String) && !uri.ascii_only?
31
+ return URI(uri) unless uri.is_a?(String) && !uri.ascii_only?
32
32
 
33
- uri = Kernel.URI(URIParser.escape(uri))
33
+ uri = URI(URIParser.escape(uri))
34
34
 
35
35
  non_ascii_hostname = URIParser.unescape(uri.host)
36
36
 
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.15.3"
4
+ VERSION = "0.17.0"
5
5
  end
data/lib/httpx.rb CHANGED
@@ -20,6 +20,7 @@ require "httpx/response"
20
20
  require "httpx/options"
21
21
  require "httpx/chainable"
22
22
 
23
+ require "mutex_m"
23
24
  # Top-Level Namespace
24
25
  #
25
26
  module HTTPX
@@ -28,15 +29,16 @@ module HTTPX
28
29
  #
29
30
  module Plugins
30
31
  @plugins = {}
32
+ @plugins.extend(Mutex_m)
31
33
 
32
34
  # Loads a plugin based on a name. If the plugin hasn't been loaded, tries to load
33
35
  # it from the load path under "httpx/plugins/" directory.
34
36
  #
35
37
  def self.load_plugin(name)
36
38
  h = @plugins
37
- unless (plugin = h[name])
39
+ unless (plugin = h.synchronize { h[name] })
38
40
  require "httpx/plugins/#{name}"
39
- raise "Plugin #{name} hasn't been registered" unless (plugin = h[name])
41
+ raise "Plugin #{name} hasn't been registered" unless (plugin = h.synchronize { h[name] })
40
42
  end
41
43
  plugin
42
44
  end
@@ -44,7 +46,8 @@ module HTTPX
44
46
  # Registers a plugin (+mod+) in the central store indexed by +name+.
45
47
  #
46
48
  def self.register_plugin(name, mod)
47
- @plugins[name] = mod
49
+ h = @plugins
50
+ h.synchronize { h[name] = mod }
48
51
  end
49
52
  end
50
53
 
data/sig/buffer.rbs CHANGED
@@ -1,5 +1,7 @@
1
1
  module HTTPX
2
2
  class Buffer
3
+ extend Forwardable
4
+
3
5
  include _ToS
4
6
  include _ToStr
5
7
 
@@ -11,7 +13,7 @@ module HTTPX
11
13
  def shift!: (Integer) -> void
12
14
 
13
15
  # delegated
14
- def <<: (string data) -> void
16
+ def <<: (string data) -> String
15
17
  def empty?: () -> bool
16
18
  def bytesize: () -> Integer
17
19
  def clear: () -> void
data/sig/chainable.rbs CHANGED
@@ -1,43 +1,44 @@
1
1
  module HTTPX
2
2
  module Chainable
3
- def request: (*untyped, **untyped) -> (response | Array[response])
3
+ def request: (*Request, **untyped) -> Array[response]
4
+ | (Request, **untyped) -> response
5
+ | (verb | string, uri | [uri], **untyped) -> response
6
+ | (Array[[verb | string, uri] | [verb | string, uri, options]], **untyped) -> Array[response]
7
+ | (verb | string, _Each[uri | [uri, options]], **untyped) -> Array[response]
8
+
4
9
  def accept: (String) -> Session
5
10
  def wrap: () { (Session) -> void } -> void
6
- | () -> void
7
11
 
8
12
  def with: (options) -> Session
9
- | (options) { (Session) -> Session} -> Session
10
-
11
-
12
-
13
+ | (options) { (Session) -> void } -> void
13
14
 
14
- def plugin: (:authentication) -> Plugins::sessionAuthentication
15
- | (:basic_authentication) -> Plugins::sessionBasicAuthentication
16
- | (:digest_authentication) -> Plugins::sessionDigestAuthentication
17
- | (:ntlm_authentication) -> Plugins::sessionNTLMAuthentication
18
- | (:aws_sdk_authentication) -> Plugins::sessionAwsSdkAuthentication
19
- | (:compression) -> Session
20
- | (:cookies) -> Plugins::sessionCookies
21
- | (:expect) -> Session
22
- | (:follow_redirects) -> Plugins::sessionFollowRedirects
23
- | (:upgrade) -> Session
24
- | (:h2c) -> Session
25
- | (:multipart) -> Session
26
- | (:persistent) -> Plugins::sessionPersistent
27
- | (:proxy) -> Plugins::sessionProxy
28
- | (:push_promise) -> Plugins::sessionPushPromise
29
- | (:retries) -> Plugins::sessionRetries
30
- | (:rate_limiter) -> Session
31
- | (:stream) -> Plugins::sessionStream
32
- | (:aws_sigv4) -> Plugins::awsSigV4Session
33
- | (:grpc) -> Plugins::grpcSession
34
- | (Symbol | Module, ?options?) { (Class) -> void } -> Session
35
- | (Symbol | Module, ?options?) -> Session
15
+ def plugin: (:authentication, ?options) -> Plugins::sessionAuthentication
16
+ | (:basic_authentication, ?options) -> Plugins::sessionBasicAuthentication
17
+ | (:digest_authentication, ?options) -> Plugins::sessionDigestAuthentication
18
+ | (:ntlm_authentication, ?options) -> Plugins::sessionNTLMAuthentication
19
+ | (:aws_sdk_authentication, ?options) -> Plugins::sessionAwsSdkAuthentication
20
+ | (:compression, ?options) -> Session
21
+ | (:cookies, ?options) -> Plugins::sessionCookies
22
+ | (:expect, ?options) -> Session
23
+ | (:follow_redirects, ?options) -> Plugins::sessionFollowRedirects
24
+ | (:upgrade, ?options) -> Session
25
+ | (:h2c, ?options) -> Session
26
+ | (:multipart, ?options) -> Session
27
+ | (:persistent, ?options) -> Plugins::sessionPersistent
28
+ | (:proxy, ?options) -> Plugins::sessionProxy
29
+ | (:push_promise, ?options) -> Plugins::sessionPushPromise
30
+ | (:retries, ?options) -> Plugins::sessionRetries
31
+ | (:rate_limiter, ?options) -> Session
32
+ | (:stream, ?options) -> Plugins::sessionStream
33
+ | (:aws_sigv4, ?options) -> Plugins::awsSigV4Session
34
+ | (:grpc, ?options) -> Plugins::grpcSession
35
+ | (Symbol | Module, ?options) { (Class) -> void } -> Session
36
+ | (Symbol | Module, ?options) -> Session
36
37
 
37
38
  private
38
39
 
39
40
  def default_options: () -> Options
40
41
  def branch: (options) -> Session
41
- | (options) { (Session) -> Session } -> Session
42
+ | (options) { (Session) -> void } -> Session
42
43
  end
43
44
  end