httpx 1.2.6 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/1_3_0.md +18 -0
  3. data/lib/httpx/adapters/datadog.rb +1 -1
  4. data/lib/httpx/adapters/webmock.rb +1 -1
  5. data/lib/httpx/connection/http1.rb +2 -2
  6. data/lib/httpx/connection/http2.rb +6 -6
  7. data/lib/httpx/connection.rb +6 -4
  8. data/lib/httpx/io/tcp.rb +1 -1
  9. data/lib/httpx/io/unix.rb +1 -1
  10. data/lib/httpx/options.rb +3 -7
  11. data/lib/httpx/plugins/aws_sigv4.rb +1 -1
  12. data/lib/httpx/plugins/cookies.rb +6 -6
  13. data/lib/httpx/plugins/follow_redirects.rb +22 -23
  14. data/lib/httpx/plugins/grpc.rb +2 -2
  15. data/lib/httpx/plugins/h2c.rb +1 -1
  16. data/lib/httpx/plugins/oauth.rb +1 -1
  17. data/lib/httpx/plugins/proxy/http.rb +2 -2
  18. data/lib/httpx/plugins/proxy/socks4.rb +1 -1
  19. data/lib/httpx/plugins/proxy/socks5.rb +1 -1
  20. data/lib/httpx/plugins/ssrf_filter.rb +1 -1
  21. data/lib/httpx/request/body.rb +37 -41
  22. data/lib/httpx/request.rb +36 -10
  23. data/lib/httpx/resolver/https.rb +1 -1
  24. data/lib/httpx/resolver/resolver.rb +1 -1
  25. data/lib/httpx/response.rb +2 -2
  26. data/lib/httpx/session.rb +20 -17
  27. data/lib/httpx/timers.rb +1 -1
  28. data/lib/httpx/version.rb +1 -1
  29. data/sig/chainable.rbs +2 -2
  30. data/sig/connection/http1.rbs +1 -1
  31. data/sig/connection/http2.rbs +16 -16
  32. data/sig/connection.rbs +2 -2
  33. data/sig/httpx.rbs +3 -3
  34. data/sig/io/tcp.rbs +1 -1
  35. data/sig/io/unix.rbs +1 -1
  36. data/sig/options.rbs +1 -13
  37. data/sig/plugins/follow_redirects.rbs +1 -1
  38. data/sig/plugins/proxy/http.rbs +3 -0
  39. data/sig/plugins/push_promise.rbs +3 -3
  40. data/sig/request/body.rbs +1 -3
  41. data/sig/request.rbs +2 -1
  42. data/sig/resolver/resolver.rbs +1 -1
  43. data/sig/response.rbs +1 -1
  44. data/sig/session.rbs +9 -6
  45. metadata +7 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fc8cbe89a9d05f24f615e5de7874c65147954cc8d06524955fea9d0e4ef5598
4
- data.tar.gz: e97b5febb579cd1c5e035faef9cf0368ab7148882d2ed95a0454b52fd0d31621
3
+ metadata.gz: 99138c8286fb426f6bd70a62357cbaf1b54f3ceb030f1ff3c78c9e2bffd8e75a
4
+ data.tar.gz: 59a28cbadff4830ed047eba007b5f71455b5a8d6aa3e111cfb5897b82b1350fa
5
5
  SHA512:
6
- metadata.gz: 55631972d465e4ea086dcaced389f7998380f052c369004f45d286d0502c612289dc5a19deff7ca26c9c0cfd6e2c4926ba5e32744c366f18884f97aedb3ad5bf
7
- data.tar.gz: 9eb1be90bceb56c335a84b180ae6c7fc065944ae1fd6dab17d9e4802c7fb62c7d3f34d3c98ba41a9cb1b8e503a929eb97cd8a667a9f536090ef266936efb81d9
6
+ metadata.gz: 78b08826c993b9a2c5d1164a2bf6c7bb4123cb9599a1ddc44bd38b827c91da73abf4fee18ae39d67f9370834b3a8d04eb32999cf2c68f9fe654a0605e6d7ca5b
7
+ data.tar.gz: 6b22a1e473abc7967314785f6fb517bf5d663d87951a7a2cba5855913a348b95dc50e2fddaa801fbcf25aef96b4d7d9b4e4d0dda8388696c0b628ba0c5dd7c1b
@@ -0,0 +1,18 @@
1
+ # 1.3.0
2
+
3
+ ## Dependencies
4
+
5
+ `http-2` v1.0.0 is replacing `http-2-next` as the HTTP/2 parser.
6
+
7
+ `http-2-next` was forked from `http-2` 5 years ago; its improvements have been merged back to `http-2` recently though, so `http-2-next` willl therefore no longer be maintained.
8
+
9
+ ## Improvements
10
+
11
+ Request-specific options (`:params`, `:form`, `:json` and `:xml`) are now separately kept by the request, which allows them to share `HTTPX::Options`, and reduce the number of copying / allocations.
12
+
13
+ This means that `HTTPX::Options` will throw an error if you initialize an object which such keys; this should not happen, as this class is considered internal and you should not be using it directly.
14
+
15
+ ## Fixes
16
+
17
+ * support for the `datadog` gem v2.0.0 in its adapter has been unblocked, now that the gem has been released.
18
+ * loading the `:cookies` plugin was making the `Session#build_request` private.
@@ -142,7 +142,7 @@ module Datadog::Tracing
142
142
  @configuration ||= Datadog.configuration.tracing[:httpx, @request.uri.host]
143
143
  end
144
144
 
145
- if Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("2.0.0.beta1")
145
+ if Gem::Version.new(DATADOG_VERSION::STRING) >= Gem::Version.new("2.0.0")
146
146
  def propagate_trace_http(digest, headers)
147
147
  Datadog::Tracing::Contrib::HTTP.inject(digest, headers)
148
148
  end
@@ -47,7 +47,7 @@ module WebMock
47
47
  end
48
48
 
49
49
  def build_error_response(request, exception)
50
- HTTPX::ErrorResponse.new(request, exception, request.options)
50
+ HTTPX::ErrorResponse.new(request, exception)
51
51
  end
52
52
  end
53
53
 
@@ -15,7 +15,7 @@ module HTTPX
15
15
  attr_accessor :max_concurrent_requests
16
16
 
17
17
  def initialize(buffer, options)
18
- @options = Options.new(options)
18
+ @options = options
19
19
  @max_concurrent_requests = @options.max_concurrent_requests || MAX_REQUESTS
20
20
  @max_requests = @options.max_requests
21
21
  @parser = Parser::HTTP1.new(self)
@@ -146,7 +146,7 @@ module HTTPX
146
146
 
147
147
  response << chunk
148
148
  rescue StandardError => e
149
- error_response = ErrorResponse.new(request, e, request.options)
149
+ error_response = ErrorResponse.new(request, e)
150
150
  request.response = error_response
151
151
  dispatch
152
152
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "securerandom"
4
- require "http/2/next"
4
+ require "http/2"
5
5
 
6
6
  module HTTPX
7
7
  class Connection::HTTP2
8
8
  include Callbacks
9
9
  include Loggable
10
10
 
11
- MAX_CONCURRENT_REQUESTS = HTTP2Next::DEFAULT_MAX_CONCURRENT_STREAMS
11
+ MAX_CONCURRENT_REQUESTS = ::HTTP2::DEFAULT_MAX_CONCURRENT_STREAMS
12
12
 
13
13
  class Error < Error
14
14
  def initialize(id, code)
@@ -25,7 +25,7 @@ module HTTPX
25
25
  attr_reader :streams, :pending
26
26
 
27
27
  def initialize(buffer, options)
28
- @options = Options.new(options)
28
+ @options = options
29
29
  @settings = @options.http2_settings
30
30
  @pending = []
31
31
  @streams = {}
@@ -111,7 +111,7 @@ module HTTPX
111
111
  end
112
112
  handle(request, stream)
113
113
  true
114
- rescue HTTP2Next::Error::StreamLimitExceeded
114
+ rescue ::HTTP2::Error::StreamLimitExceeded
115
115
  @pending.unshift(request)
116
116
  end
117
117
 
@@ -168,7 +168,7 @@ module HTTPX
168
168
  end
169
169
 
170
170
  def init_connection
171
- @connection = HTTP2Next::Client.new(@settings)
171
+ @connection = ::HTTP2::Client.new(@settings)
172
172
  @connection.on(:frame, &method(:on_frame))
173
173
  @connection.on(:frame_sent, &method(:on_frame_sent))
174
174
  @connection.on(:frame_received, &method(:on_frame_received))
@@ -309,7 +309,7 @@ module HTTPX
309
309
  if error
310
310
  ex = Error.new(stream.id, error)
311
311
  ex.set_backtrace(caller)
312
- response = ErrorResponse.new(request, ex, request.options)
312
+ response = ErrorResponse.new(request, ex)
313
313
  request.response = response
314
314
  emit(:response, request, response)
315
315
  else
@@ -48,6 +48,8 @@ module HTTPX
48
48
  attr_accessor :family
49
49
 
50
50
  def initialize(uri, options)
51
+ @origins = [uri.origin]
52
+ @origin = Utils.to_uri(uri.origin)
51
53
  @options = Options.new(options)
52
54
  @type = initialize_type(uri, @options)
53
55
  @origins = [uri.origin]
@@ -337,7 +339,7 @@ module HTTPX
337
339
  #
338
340
  loop do
339
341
  siz = @io.read(@window_size, @read_buffer)
340
- log(level: 3, color: :cyan) { "IO READ: #{siz} bytes..." }
342
+ log(level: 3, color: :cyan) { "IO READ: #{siz} bytes... (wsize: #{@window_size}, rbuffer: #{@read_buffer.bytesize})" }
341
343
  unless siz
342
344
  ex = EOFError.new("descriptor closed")
343
345
  ex.set_backtrace(caller)
@@ -504,7 +506,7 @@ module HTTPX
504
506
  when MisdirectedRequestError
505
507
  emit(:misdirected, request)
506
508
  else
507
- response = ErrorResponse.new(request, ex, @options)
509
+ response = ErrorResponse.new(request, ex)
508
510
  request.response = response
509
511
  request.emit(:response, response)
510
512
  end
@@ -530,7 +532,7 @@ module HTTPX
530
532
  connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, error) : handle_error(error)
531
533
  @state = :closed
532
534
  emit(:close)
533
- rescue TLSError, HTTP2Next::Error::ProtocolError, HTTP2Next::Error::HandshakeError => e
535
+ rescue TLSError, ::HTTP2::Error::ProtocolError, ::HTTP2::Error::HandshakeError => e
534
536
  # connect errors, exit gracefully
535
537
  handle_error(e)
536
538
  connecting? && callbacks_for?(:connect_error) ? emit(:connect_error, e) : handle_error(e)
@@ -657,7 +659,7 @@ module HTTPX
657
659
  def handle_error(error)
658
660
  parser.handle_error(error) if @parser && parser.respond_to?(:handle_error)
659
661
  while (request = @pending.shift)
660
- response = ErrorResponse.new(request, error, request.options)
662
+ response = ErrorResponse.new(request, error)
661
663
  request.response = response
662
664
  request.emit(:response, response)
663
665
  end
data/lib/httpx/io/tcp.rb CHANGED
@@ -17,7 +17,7 @@ module HTTPX
17
17
  @state = :idle
18
18
  @addresses = []
19
19
  @hostname = origin.host
20
- @options = Options.new(options)
20
+ @options = options
21
21
  @fallback_protocol = @options.fallback_protocol
22
22
  @port = origin.port
23
23
  @interests = :w
data/lib/httpx/io/unix.rb CHANGED
@@ -12,7 +12,7 @@ module HTTPX
12
12
  @addresses = []
13
13
  @hostname = origin.host
14
14
  @state = :idle
15
- @options = Options.new(options)
15
+ @options = options
16
16
  @fallback_protocol = @options.fallback_protocol
17
17
  if @options.io
18
18
  @io = case @options.io
data/lib/httpx/options.rb CHANGED
@@ -91,7 +91,7 @@ module HTTPX
91
91
  # :debug :: an object which log messages are written to (must respond to <tt><<</tt>)
92
92
  # :debug_level :: the log level of messages (can be 1, 2, or 3).
93
93
  # :ssl :: a hash of options which can be set as params of OpenSSL::SSL::SSLContext (see HTTPX::IO::SSL)
94
- # :http2_settings :: a hash of options to be passed to a HTTP2Next::Connection (ex: <tt>{ max_concurrent_streams: 2 }</tt>)
94
+ # :http2_settings :: a hash of options to be passed to a HTTP2::Connection (ex: <tt>{ max_concurrent_streams: 2 }</tt>)
95
95
  # :fallback_protocol :: version of HTTP protocol to use by default in the absence of protocol negotiation
96
96
  # like ALPN (defaults to <tt>"http/1.1"</tt>)
97
97
  # :supported_compression_formats :: list of compressions supported by the transcoder layer (defaults to <tt>%w[gzip deflate]</tt>).
@@ -124,10 +124,6 @@ module HTTPX
124
124
  # :base_path :: path to prefix given relative paths with (ex: "/v2")
125
125
  # :max_concurrent_requests :: max number of requests which can be set concurrently
126
126
  # :max_requests :: max number of requests which can be made on socket before it reconnects.
127
- # :params :: hash or array of key-values which will be encoded and set in the query string of request uris.
128
- # :form :: hash of array of key-values which will be form-or-multipart-encoded in requests body payload.
129
- # :json :: hash of array of key-values which will be JSON-encoded in requests body payload.
130
- # :xml :: Nokogiri XML nodes which will be encoded in requests body payload.
131
127
  #
132
128
  # This list of options are enhanced with each loaded plugin, see the plugin docs for details.
133
129
  def initialize(options = {})
@@ -216,7 +212,7 @@ module HTTPX
216
212
  end
217
213
 
218
214
  %i[
219
- params form json xml body ssl http2_settings
215
+ ssl http2_settings
220
216
  request_class response_class headers_class request_body_class
221
217
  response_body_class connection_class options_class
222
218
  io fallback_protocol debug debug_level resolver_class resolver_options
@@ -228,7 +224,7 @@ module HTTPX
228
224
  OUT
229
225
  end
230
226
 
231
- REQUEST_BODY_IVARS = %i[@headers @params @form @xml @json @body].freeze
227
+ REQUEST_BODY_IVARS = %i[@headers].freeze
232
228
 
233
229
  def ==(other)
234
230
  super || options_equals?(other)
@@ -160,7 +160,7 @@ module HTTPX
160
160
  with(sigv4_signer: Signer.new(**options))
161
161
  end
162
162
 
163
- def build_request(*, _)
163
+ def build_request(*)
164
164
  request = super
165
165
 
166
166
  return request if request.headers.key?("authorization")
@@ -40,6 +40,12 @@ module HTTPX
40
40
  end
41
41
  end
42
42
 
43
+ def build_request(*)
44
+ request = super
45
+ request.headers.set_cookie(request.options.cookies[request.uri])
46
+ request
47
+ end
48
+
43
49
  private
44
50
 
45
51
  def on_response(_request, response)
@@ -52,12 +58,6 @@ module HTTPX
52
58
 
53
59
  super
54
60
  end
55
-
56
- def build_request(*, _)
57
- request = super
58
- request.headers.set_cookie(request.options.cookies[request.uri])
59
- request
60
- end
61
61
  end
62
62
 
63
63
  module HeadersMethods
@@ -71,40 +71,40 @@ module HTTPX
71
71
  # build redirect request
72
72
  request_body = redirect_request.body
73
73
  redirect_method = "GET"
74
+ redirect_params = {}
74
75
 
75
76
  if response.status == 305 && options.respond_to?(:proxy)
76
77
  request_body.rewind
77
78
  # The requested resource MUST be accessed through the proxy given by
78
79
  # the Location field. The Location field gives the URI of the proxy.
79
- retry_options = options.merge(headers: redirect_request.headers,
80
- proxy: { uri: redirect_uri },
81
- body: request_body,
82
- max_redirects: max_redirects - 1)
80
+ redirect_options = options.merge(headers: redirect_request.headers,
81
+ proxy: { uri: redirect_uri },
82
+ max_redirects: max_redirects - 1)
83
+
84
+ redirect_params[:body] = request_body
83
85
  redirect_uri = redirect_request.uri
84
- options = retry_options
86
+ options = redirect_options
85
87
  else
86
88
  redirect_headers = redirect_request_headers(redirect_request.uri, redirect_uri, request.headers, options)
87
-
88
- retry_opts = Hash[options].merge(max_redirects: max_redirects - 1)
89
+ redirect_opts = Hash[options]
90
+ redirect_params[:max_redirects] = max_redirects - 1
89
91
 
90
92
  unless request_body.empty?
91
93
  if response.status == 307
92
94
  # The method and the body of the original request are reused to perform the redirected request.
93
95
  redirect_method = redirect_request.verb
94
96
  request_body.rewind
95
- retry_opts[:body] = request_body
97
+ redirect_params[:body] = request_body
96
98
  else
97
99
  # redirects are **ALWAYS** GET, so remove body-related headers
98
100
  REQUEST_BODY_HEADERS.each do |h|
99
101
  redirect_headers.delete(h)
100
102
  end
101
- retry_opts.delete(:body)
103
+ redirect_params[:body] = nil
102
104
  end
103
105
  end
104
106
 
105
- retry_opts[:headers] = redirect_headers.to_h
106
-
107
- retry_options = options.class.new(retry_opts)
107
+ options = options.class.new(redirect_opts.merge(headers: redirect_headers.to_h))
108
108
  end
109
109
 
110
110
  redirect_uri = Utils.to_uri(redirect_uri)
@@ -114,26 +114,26 @@ module HTTPX
114
114
  redirect_uri.scheme == "http"
115
115
  error = InsecureRedirectError.new(redirect_uri.to_s)
116
116
  error.set_backtrace(caller)
117
- return ErrorResponse.new(request, error, options)
117
+ return ErrorResponse.new(request, error)
118
118
  end
119
119
 
120
- retry_request = build_request(redirect_method, redirect_uri, retry_options)
120
+ retry_request = build_request(redirect_method, redirect_uri, redirect_params, options)
121
121
 
122
122
  request.redirect_request = retry_request
123
123
 
124
- retry_after = response.headers["retry-after"]
124
+ redirect_after = response.headers["retry-after"]
125
125
 
126
- if retry_after
126
+ if redirect_after
127
127
  # Servers send the "Retry-After" header field to indicate how long the
128
128
  # user agent ought to wait before making a follow-up request.
129
129
  # When sent with any 3xx (Redirection) response, Retry-After indicates
130
130
  # the minimum time that the user agent is asked to wait before issuing
131
131
  # the redirected request.
132
132
  #
133
- retry_after = Utils.parse_retry_after(retry_after)
133
+ redirect_after = Utils.parse_retry_after(redirect_after)
134
134
 
135
- log { "redirecting after #{retry_after} secs..." }
136
- pool.after(retry_after) do
135
+ log { "redirecting after #{redirect_after} secs..." }
136
+ pool.after(redirect_after) do
137
137
  send_request(retry_request, connections, options)
138
138
  end
139
139
  else
@@ -149,10 +149,9 @@ module HTTPX
149
149
 
150
150
  return headers unless headers.key?("authorization")
151
151
 
152
- unless original_uri.origin == redirect_uri.origin
153
- headers = headers.dup
154
- headers.delete("authorization")
155
- end
152
+ return headers if original_uri.origin == redirect_uri.origin
153
+
154
+ headers.delete("authorization")
156
155
 
157
156
  headers
158
157
  end
@@ -110,10 +110,10 @@ module HTTPX
110
110
  end
111
111
 
112
112
  module RequestBodyMethods
113
- def initialize(headers, _)
113
+ def initialize(*, **)
114
114
  super
115
115
 
116
- if (compression = headers["grpc-encoding"])
116
+ if (compression = @headers["grpc-encoding"])
117
117
  deflater_body = self.class.initialize_deflater_body(@body, compression)
118
118
  @body = Transcoder::GRPCEncoding.encode(deflater_body || @body, compressed: !deflater_body.nil?)
119
119
  else
@@ -39,7 +39,7 @@ module HTTPX
39
39
  upgrade_request.headers.add("connection", "upgrade")
40
40
  upgrade_request.headers.add("connection", "http2-settings")
41
41
  upgrade_request.headers["upgrade"] = "h2c"
42
- upgrade_request.headers["http2-settings"] = HTTP2Next::Client.settings_header(upgrade_request.options.http2_settings)
42
+ upgrade_request.headers["http2-settings"] = ::HTTP2::Client.settings_header(upgrade_request.options.http2_settings)
43
43
 
44
44
  super(upgrade_request, *remainder)
45
45
  end
@@ -155,7 +155,7 @@ module HTTPX
155
155
  with(oauth_session: oauth_session.merge(access_token: access_token, refresh_token: refresh_token))
156
156
  end
157
157
 
158
- def build_request(*, _)
158
+ def build_request(*)
159
159
  request = super
160
160
 
161
161
  return request if request.headers.key?("authorization")
@@ -163,8 +163,8 @@ module HTTPX
163
163
  end
164
164
 
165
165
  class ConnectRequest < Request
166
- def initialize(uri, _options)
167
- super("CONNECT", uri, {})
166
+ def initialize(uri, options)
167
+ super("CONNECT", uri, options)
168
168
  @headers.delete("accept")
169
169
  end
170
170
 
@@ -89,7 +89,7 @@ module HTTPX
89
89
 
90
90
  def initialize(buffer, options)
91
91
  @buffer = buffer
92
- @options = Options.new(options)
92
+ @options = options
93
93
  end
94
94
 
95
95
  def close; end
@@ -141,7 +141,7 @@ module HTTPX
141
141
 
142
142
  def initialize(buffer, options)
143
143
  @buffer = buffer
144
- @options = Options.new(options)
144
+ @options = options
145
145
  end
146
146
 
147
147
  def close; end
@@ -100,7 +100,7 @@ module HTTPX
100
100
 
101
101
  error = ServerSideRequestForgeryError.new("#{request.uri} URI scheme not allowed")
102
102
  error.set_backtrace(caller)
103
- response = ErrorResponse.new(request, error, request.options)
103
+ response = ErrorResponse.new(request, error)
104
104
  request.emit(:response, response)
105
105
  response
106
106
  end
@@ -4,30 +4,53 @@ module HTTPX
4
4
  # Implementation of the HTTP Request body as a delegator which iterates (responds to +each+) payload chunks.
5
5
  class Request::Body < SimpleDelegator
6
6
  class << self
7
- def new(_, options)
8
- return options.body if options.body.is_a?(self)
7
+ def new(_, options, body: nil, **params)
8
+ if body.is_a?(self)
9
+ # request derives its options from body
10
+ body.options = options.merge(params)
11
+ return body
12
+ end
9
13
 
10
14
  super
11
15
  end
12
16
  end
13
17
 
14
- # inits the instance with the request +headers+ and +options+, which contain the payload definition.
15
- def initialize(headers, options)
16
- @headers = headers
18
+ attr_accessor :options
17
19
 
18
- # forego compression in the Range request case
19
- if @headers.key?("range")
20
- @headers.delete("accept-encoding")
21
- else
22
- @headers["accept-encoding"] ||= options.supported_compression_formats
20
+ # inits the instance with the request +headers+, +options+ and +params+, which contain the payload definition.
21
+ # it wraps the given body with the appropriate encoder on initialization.
22
+ #
23
+ # ..., json: { foo: "bar" }) #=> json encoder
24
+ # ..., form: { foo: "bar" }) #=> form urlencoded encoder
25
+ # ..., form: { foo: Pathname.open("path/to/file") }) #=> multipart urlencoded encoder
26
+ # ..., form: { foo: File.open("path/to/file") }) #=> multipart urlencoded encoder
27
+ # ..., form: { body: "bla") }) #=> raw data encoder
28
+ def initialize(headers, options, body: nil, form: nil, json: nil, xml: nil, **params)
29
+ @headers = headers
30
+ @options = options.merge(params)
31
+
32
+ @body = if body
33
+ Transcoder::Body.encode(body)
34
+ elsif form
35
+ Transcoder::Form.encode(form)
36
+ elsif json
37
+ Transcoder::JSON.encode(json)
38
+ elsif xml
39
+ Transcoder::Xml.encode(xml)
23
40
  end
24
41
 
25
- initialize_body(options)
42
+ if @body
43
+ if @options.compress_request_body && @headers.key?("content-encoding")
26
44
 
27
- return if @body.nil?
45
+ @headers.get("content-encoding").each do |encoding|
46
+ @body = self.class.initialize_deflater_body(@body, encoding)
47
+ end
48
+ end
49
+
50
+ @headers["content-type"] ||= @body.content_type
51
+ @headers["content-length"] = @body.bytesize unless unbounded_body?
52
+ end
28
53
 
29
- @headers["content-type"] ||= @body.content_type
30
- @headers["content-length"] = @body.bytesize unless unbounded_body?
31
54
  super(@body)
32
55
  end
33
56
 
@@ -99,33 +122,6 @@ module HTTPX
99
122
  end
100
123
  # :nocov:
101
124
 
102
- private
103
-
104
- # wraps the given body with the appropriate encoder.
105
- #
106
- # ..., json: { foo: "bar" }) #=> json encoder
107
- # ..., form: { foo: "bar" }) #=> form urlencoded encoder
108
- # ..., form: { foo: Pathname.open("path/to/file") }) #=> multipart urlencoded encoder
109
- # ..., form: { foo: File.open("path/to/file") }) #=> multipart urlencoded encoder
110
- # ..., form: { body: "bla") }) #=> raw data encoder
111
- def initialize_body(options)
112
- @body = if options.body
113
- Transcoder::Body.encode(options.body)
114
- elsif options.form
115
- Transcoder::Form.encode(options.form)
116
- elsif options.json
117
- Transcoder::JSON.encode(options.json)
118
- elsif options.xml
119
- Transcoder::Xml.encode(options.xml)
120
- end
121
-
122
- return unless @body && options.compress_request_body && @headers.key?("content-encoding")
123
-
124
- @headers.get("content-encoding").each do |encoding|
125
- @body = self.class.initialize_deflater_body(@body, encoding)
126
- end
127
- end
128
-
129
125
  class << self
130
126
  # returns the +body+ wrapped with the correct deflater accordinng to the given +encodisng+.
131
127
  def initialize_deflater_body(body, encoding)
data/lib/httpx/request.rb CHANGED
@@ -46,12 +46,43 @@ module HTTPX
46
46
  # will be +true+ when request body has been completely flushed.
47
47
  def_delegator :@body, :empty?
48
48
 
49
- # initializes the instance with the given +verb+, an absolute or relative +uri+, and the
50
- # request options.
51
- def initialize(verb, uri, options = {})
49
+ # initializes the instance with the given +verb+ (an upppercase String, ex. 'GEt'),
50
+ # an absolute or relative +uri+ (either as String or URI::HTTP object), the
51
+ # request +options+ (instance of HTTPX::Options) and an optional Hash of +params+.
52
+ #
53
+ # Besides any of the options documented in HTTPX::Options (which would override or merge with what
54
+ # +options+ sets), it accepts also the following:
55
+ #
56
+ # :params :: hash or array of key-values which will be encoded and set in the query string of request uris.
57
+ # :body :: to be encoded in the request body payload. can be a String, an IO object (i.e. a File), or an Enumerable.
58
+ # :form :: hash of array of key-values which will be form-urlencoded- or multipart-encoded in requests body payload.
59
+ # :json :: hash of array of key-values which will be JSON-encoded in requests body payload.
60
+ # :xml :: Nokogiri XML nodes which will be encoded in requests body payload.
61
+ #
62
+ # :body, :form, :json and :xml are all mutually exclusive, i.e. only one of them gets picked up.
63
+ def initialize(verb, uri, options, params = EMPTY_HASH)
52
64
  @verb = verb.to_s.upcase
53
- @options = Options.new(options)
54
65
  @uri = Utils.to_uri(uri)
66
+
67
+ @headers = options.headers.dup
68
+ merge_headers(params.delete(:headers)) if params.key?(:headers)
69
+
70
+ @headers["user-agent"] ||= USER_AGENT
71
+ @headers["accept"] ||= "*/*"
72
+
73
+ # forego compression in the Range request case
74
+ if @headers.key?("range")
75
+ @headers.delete("accept-encoding")
76
+ else
77
+ @headers["accept-encoding"] ||= options.supported_compression_formats
78
+ end
79
+
80
+ @query_params = params.delete(:params) if params.key?(:params)
81
+
82
+ @body = options.request_body_class.new(@headers, options, **params)
83
+
84
+ @options = @body.options
85
+
55
86
  if @uri.relative?
56
87
  origin = @options.origin
57
88
  raise(Error, "invalid URI: #{@uri}") unless origin
@@ -61,11 +92,6 @@ module HTTPX
61
92
  @uri = origin.merge("#{base_path}#{@uri}")
62
93
  end
63
94
 
64
- @headers = @options.headers.dup
65
- @headers["user-agent"] ||= USER_AGENT
66
- @headers["accept"] ||= "*/*"
67
-
68
- @body = @options.request_body_class.new(@headers, @options)
69
95
  @state = :idle
70
96
  @response = nil
71
97
  @peer_address = nil
@@ -172,7 +198,7 @@ module HTTPX
172
198
  return @query if defined?(@query)
173
199
 
174
200
  query = []
175
- if (q = @options.params)
201
+ if (q = @query_params)
176
202
  query << Transcoder::Form.encode(q)
177
203
  end
178
204
  query << @uri.query if @uri.query
@@ -219,7 +219,7 @@ module HTTPX
219
219
  uri.query = URI.encode_www_form(params)
220
220
  request = rklass.new("GET", uri, @options)
221
221
  else
222
- request = rklass.new("POST", uri, @options.merge(body: [payload]))
222
+ request = rklass.new("POST", uri, @options, body: [payload])
223
223
  request.headers["content-type"] = "application/dns-message"
224
224
  end
225
225
  request.headers["accept"] = "application/dns-message"
@@ -33,7 +33,7 @@ module HTTPX
33
33
  def initialize(family, options)
34
34
  @family = family
35
35
  @record_type = RECORD_TYPES[family]
36
- @options = Options.new(options)
36
+ @options = options
37
37
  end
38
38
 
39
39
  def close; end
@@ -247,11 +247,11 @@ module HTTPX
247
247
  # the IP address of the peer server.
248
248
  def_delegator :@request, :peer_address
249
249
 
250
- def initialize(request, error, options)
250
+ def initialize(request, error)
251
251
  @request = request
252
252
  @response = request.response if request.response.is_a?(Response)
253
253
  @error = error
254
- @options = Options.new(options)
254
+ @options = request.options
255
255
  log_exception(@error)
256
256
  end
257
257
 
data/lib/httpx/session.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
+ EMPTY_HASH = {}.freeze
5
+
4
6
  # Class implementing the APIs being used publicly.
5
7
  #
6
8
  # HTTPX.get(..) #=> delegating to an internal HTTPX::Session object.
@@ -9,8 +11,6 @@ module HTTPX
9
11
  include Loggable
10
12
  include Chainable
11
13
 
12
- EMPTY_HASH = {}.freeze
13
-
14
14
  # initializes the session with a set of +options+, which will be shared by all
15
15
  # requests sent from it.
16
16
  #
@@ -65,10 +65,10 @@ module HTTPX
65
65
  # resp1, resp2 = session.request(["POST", "https://server.org/a", form: { "foo" => "bar" }], ["GET", "https://server.org/b"])
66
66
  # resp1, resp2 = session.request("GET", ["https://server.org/a", "https://server.org/b"], headers: { "x-api-token" => "TOKEN" })
67
67
  #
68
- def request(*args, **options)
68
+ def request(*args, **params)
69
69
  raise ArgumentError, "must perform at least one request" if args.empty?
70
70
 
71
- requests = args.first.is_a?(Request) ? args : build_requests(*args, options)
71
+ requests = args.first.is_a?(Request) ? args : build_requests(*args, params)
72
72
  responses = send_requests(*requests)
73
73
  return responses.first if responses.size == 1
74
74
 
@@ -81,10 +81,9 @@ module HTTPX
81
81
  #
82
82
  # req = session.build_request("GET", "https://server.com")
83
83
  # resp = session.request(req)
84
- def build_request(verb, uri, options = EMPTY_HASH)
85
- rklass = @options.request_class
86
- options = @options.merge(options) unless options.is_a?(Options)
87
- request = rklass.new(verb, uri, options)
84
+ def build_request(verb, uri, params = EMPTY_HASH, options = @options)
85
+ rklass = options.request_class
86
+ request = rklass.new(verb, uri, options, params)
88
87
  request.persistent = @persistent
89
88
  set_request_callbacks(request)
90
89
  request
@@ -133,7 +132,7 @@ module HTTPX
133
132
  end
134
133
  return unless error.is_a?(Error)
135
134
 
136
- request.emit(:response, ErrorResponse.new(request, error, options))
135
+ request.emit(:response, ErrorResponse.new(request, error))
137
136
  end
138
137
 
139
138
  # sets the callbacks on the +connection+ required to process certain specific
@@ -192,22 +191,26 @@ module HTTPX
192
191
  end
193
192
 
194
193
  # returns a set of HTTPX::Request objects built from the given +args+ and +options+.
195
- def build_requests(*args, options)
196
- request_options = @options.merge(options)
197
-
194
+ def build_requests(*args, params)
198
195
  requests = if args.size == 1
199
196
  reqs = args.first
200
- reqs.map do |verb, uri, opts = EMPTY_HASH|
201
- build_request(verb, uri, request_options.merge(opts))
197
+ # TODO: find a way to make requests share same options object
198
+ reqs.map do |verb, uri, ps = EMPTY_HASH|
199
+ request_params = params
200
+ request_params = request_params.merge(ps) unless ps.empty?
201
+ build_request(verb, uri, request_params)
202
202
  end
203
203
  else
204
204
  verb, uris = args
205
205
  if uris.respond_to?(:each)
206
- uris.enum_for(:each).map do |uri, opts = EMPTY_HASH|
207
- build_request(verb, uri, request_options.merge(opts))
206
+ # TODO: find a way to make requests share same options object
207
+ uris.enum_for(:each).map do |uri, ps = EMPTY_HASH|
208
+ request_params = params
209
+ request_params = request_params.merge(ps) unless ps.empty?
210
+ build_request(verb, uri, request_params)
208
211
  end
209
212
  else
210
- [build_request(verb, uris, request_options)]
213
+ [build_request(verb, uris, params)]
211
214
  end
212
215
  end
213
216
  raise ArgumentError, "wrong number of URIs (given 0, expect 1..+1)" if requests.empty?
data/lib/httpx/timers.rb CHANGED
@@ -43,7 +43,7 @@ module HTTPX
43
43
 
44
44
  elapsed_time = Utils.elapsed_time(@next_interval_at)
45
45
 
46
- @intervals.delete_if { |interval| interval.elapse(elapsed_time) <= 0 }
46
+ @intervals = @intervals.drop_while { |interval| interval.elapse(elapsed_time) <= 0 }
47
47
 
48
48
  @next_interval_at = nil if @intervals.empty?
49
49
  end
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "1.2.6"
4
+ VERSION = "1.3.0"
5
5
  end
data/sig/chainable.rbs CHANGED
@@ -3,8 +3,8 @@ module HTTPX
3
3
  def request: (*Request, **untyped) -> Array[response]
4
4
  | (Request, **untyped) -> response
5
5
  | (verb, uri | [uri], **untyped) -> response
6
- | (Array[[verb, uri] | [verb, uri, options]], **untyped) -> Array[response]
7
- | (verb, _Each[uri | [uri, options]], **untyped) -> Array[response]
6
+ | (Array[[verb, uri] | [verb, uri, request_params]], **untyped) -> Array[response]
7
+ | (verb, _Each[uri | [uri, request_params]], **untyped) -> Array[response]
8
8
 
9
9
  def accept: (String) -> Session
10
10
  def wrap: () { (Session) -> void } -> void
@@ -58,7 +58,7 @@ module HTTPX
58
58
 
59
59
  private
60
60
 
61
- def initialize: (Buffer, options) -> untyped
61
+ def initialize: (Buffer buffer, Options options) -> untyped
62
62
 
63
63
  def manage_connection: (Request request, Response response) -> void
64
64
 
@@ -5,7 +5,7 @@ module HTTPX
5
5
 
6
6
  MAX_CONCURRENT_REQUESTS: Integer
7
7
 
8
- attr_reader streams: Hash[Request, HTTP2Next::Stream]
8
+ attr_reader streams: Hash[Request, ::HTTP2::Stream]
9
9
  attr_reader pending: Array[Request]
10
10
 
11
11
  @options: Options
@@ -42,35 +42,35 @@ module HTTPX
42
42
 
43
43
  private
44
44
 
45
- def initialize: (Buffer, options) -> untyped
45
+ def initialize: (Buffer buffer, Options options) -> untyped
46
46
 
47
47
  def send_pending: () -> void
48
48
 
49
49
  def set_protocol_headers: (Request) -> _Each[[String, String]]
50
50
 
51
- def handle: (Request request, HTTP2Next::Stream stream) -> void
51
+ def handle: (Request request, ::HTTP2::Stream stream) -> void
52
52
 
53
53
  def init_connection: () -> void
54
54
 
55
- def handle_stream: (HTTP2Next::Stream stream, Request request) -> void
55
+ def handle_stream: (::HTTP2::Stream stream, Request request) -> void
56
56
 
57
57
  def join_headline: (Request request) -> String
58
58
 
59
- def join_headers: (HTTP2Next::Stream stream, Request request) -> void
59
+ def join_headers: (::HTTP2::Stream stream, Request request) -> void
60
60
 
61
- def join_trailers: (HTTP2Next::Stream stream, Request request) -> void
61
+ def join_trailers: (::HTTP2::Stream stream, Request request) -> void
62
62
 
63
- def join_body: (HTTP2Next::Stream stream, Request request) -> void
63
+ def join_body: (::HTTP2::Stream stream, Request request) -> void
64
64
 
65
- def on_stream_headers: (HTTP2Next::Stream stream, Request request, Array[[String, String]] headers) -> void
65
+ def on_stream_headers: (::HTTP2::Stream stream, Request request, Array[[String, String]] headers) -> void
66
66
 
67
- def on_stream_trailers: (HTTP2Next::Stream stream, Response response, Array[[String, String]] headers) -> void
67
+ def on_stream_trailers: (::HTTP2::Stream stream, Response response, Array[[String, String]] headers) -> void
68
68
 
69
- def on_stream_data: (HTTP2Next::Stream stream, Request request, String data) -> void
69
+ def on_stream_data: (::HTTP2::Stream stream, Request request, String data) -> void
70
70
 
71
- def on_stream_refuse: (HTTP2Next::Stream stream, Request request, StandardError error) -> void
71
+ def on_stream_refuse: (::HTTP2::Stream stream, Request request, StandardError error) -> void
72
72
 
73
- def on_stream_close: (HTTP2Next::Stream stream, Request request, (Symbol | StandardError)? error) -> void
73
+ def on_stream_close: (::HTTP2::Stream stream, Request request, (Symbol | StandardError)? error) -> void
74
74
 
75
75
  def on_frame: (string bytes) -> void
76
76
 
@@ -78,13 +78,13 @@ module HTTPX
78
78
 
79
79
  def on_close: (Integer last_frame, Symbol? error, String? payload) -> void
80
80
 
81
- def on_frame_sent: (HTTP2Next::frame) -> void
81
+ def on_frame_sent: (::HTTP2::frame) -> void
82
82
 
83
- def on_frame_received: (HTTP2Next::frame) -> void
83
+ def on_frame_received: (::HTTP2::frame) -> void
84
84
 
85
- def on_altsvc: (String origin, HTTP2Next::frame) -> void
85
+ def on_altsvc: (String origin, ::HTTP2::frame) -> void
86
86
 
87
- def on_promise: (HTTP2Next::Stream) -> void
87
+ def on_promise: (::HTTP2::Stream) -> void
88
88
 
89
89
  def on_origin: (String) -> void
90
90
 
data/sig/connection.rbs CHANGED
@@ -93,9 +93,9 @@ module HTTPX
93
93
 
94
94
  private
95
95
 
96
- def initialize: (http_uri uri, options) -> void
96
+ def initialize: (http_uri uri, Options options) -> void
97
97
 
98
- def initialize_type: (http_uri uri, Options) -> io_type
98
+ def initialize_type: (http_uri uri, Options options) -> io_type
99
99
 
100
100
  def connect: () -> void
101
101
 
data/sig/httpx.rbs CHANGED
@@ -9,9 +9,9 @@ module HTTPX
9
9
  type uri = http_uri | string
10
10
  type generic_uri = String | URI::Generic
11
11
 
12
- type verb = "OPTIONS" | "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "TRACE" | "CONNECT" |
13
- "PROPFIND" | "PROPPATCH" | "MKCOL" | "COPY" | "MOVE" | "LOCK" | "UNLOCK" | "ORDERPATCH" |
14
- "ACL" | "REPORT" | "PATCH" | "SEARCH"
12
+ type verb = String
13
+
14
+ type request_params = Hash[Symbol, untyped]
15
15
 
16
16
  type ip_family = Integer #Socket::AF_INET6 | Socket::AF_INET
17
17
 
data/sig/io/tcp.rbs CHANGED
@@ -15,7 +15,7 @@ module HTTPX
15
15
  alias host ip
16
16
 
17
17
  # TODO: lift when https://github.com/ruby/rbs/issues/1497 fixed
18
- def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) ?{ (instance) -> void } -> void
18
+ def initialize: (URI::Generic origin, Array[ipaddr]? addresses, Options options) ?{ (instance) -> void } -> void
19
19
 
20
20
  def add_addresses: (Array[ipaddr] addrs) -> void
21
21
 
data/sig/io/unix.rbs CHANGED
@@ -15,7 +15,7 @@ module HTTPX
15
15
 
16
16
  @io: Socket
17
17
 
18
- def initialize: (http_uri origin, String? path, options options) -> void
18
+ def initialize: (http_uri origin, String? path, Options options) -> void
19
19
 
20
20
  def connect: () -> void
21
21
 
data/sig/options.rbs CHANGED
@@ -63,19 +63,7 @@ module HTTPX
63
63
  # decompress_response_body
64
64
  attr_reader decompress_response_body: bool
65
65
 
66
- # params
67
- attr_reader params: Transcoder::urlencoded_input?
68
-
69
- # form
70
- attr_reader form: Transcoder::urlencoded_input?
71
-
72
- # json
73
- attr_reader json: _ToJson?
74
-
75
- # body
76
- attr_reader body: bodyIO?
77
-
78
- # body
66
+ # origin
79
67
  attr_reader origin: URI::Generic?
80
68
 
81
69
  # base_path
@@ -24,7 +24,7 @@ module HTTPX
24
24
  module InstanceMethods
25
25
  def max_redirects: (_ToI) -> instance
26
26
 
27
- def redirect_request_headers: (http_uri original_uri, http_uri redirect_uri, Headers headers, Options & _FollowRedirectsOptions options) -> Headers
27
+ def handle_after_redirect_request: (http_uri original_uri, http_uri redirect_uri, Request request, Options & _FollowRedirectsOptions options) -> void
28
28
 
29
29
  def __get_location_from_response: (Response) -> http_uri
30
30
  end
@@ -16,6 +16,9 @@ module HTTPX
16
16
  def __http_on_connect: (top, Response) -> void
17
17
  end
18
18
 
19
+ class ConnectRequest < Request
20
+ def initialize: (generic_uri uri, Options options) -> void
21
+ end
19
22
  end
20
23
  end
21
24
 
@@ -9,9 +9,9 @@ module HTTPX
9
9
  module InstanceMethods
10
10
  private
11
11
 
12
- def promise_headers: () -> Hash[HTTP2Next::Stream, Request]
13
- def __on_promise_request: (Connection::HTTP2, HTTP2Next::Stream, headers_input) -> void
14
- def __on_promise_response: (Connection::HTTP2, HTTP2Next::Stream, headers_input) -> void
12
+ def promise_headers: () -> Hash[::HTTP2::Stream, Request]
13
+ def __on_promise_request: (Connection::HTTP2, ::HTTP2::Stream, headers_input) -> void
14
+ def __on_promise_response: (Connection::HTTP2, ::HTTP2::Stream, headers_input) -> void
15
15
  end
16
16
  end
17
17
 
data/sig/request/body.rbs CHANGED
@@ -4,7 +4,7 @@ module HTTPX
4
4
  @body: body_encoder?
5
5
  @unbounded_body: bool
6
6
 
7
- def initialize: (Headers headers, Options options) -> void
7
+ def initialize: (Headers headers, Options options, ?body: bodyIO, ?form: Transcoder::urlencoded_input?, ?json: _ToJson?, **untyped) -> void
8
8
 
9
9
  def each: () { (String) -> void } -> void
10
10
  | () -> Enumerable[String]
@@ -25,8 +25,6 @@ module HTTPX
25
25
 
26
26
  private
27
27
 
28
- def initialize_body: (Options options) -> void
29
-
30
28
  def self.initialize_deflater_body: (body_encoder body, Encoding | String encoding) -> body_encoder
31
29
  end
32
30
 
data/sig/request.rbs CHANGED
@@ -19,12 +19,13 @@ module HTTPX
19
19
 
20
20
  attr_writer persistent: bool
21
21
 
22
+ @query_params: Hash[interned, untyped]?
22
23
  @trailers: Headers?
23
24
  @informational_status: Integer?
24
25
  @query: String?
25
26
  @drainer: Enumerator[String, void]?
26
27
 
27
- def initialize: (Symbol | String, generic_uri, ?options) -> untyped
28
+ def initialize: (Symbol | String verb, generic_uri uri, Options options, ?request_params params) -> untyped
28
29
 
29
30
  def interests: () -> (:r | :w)
30
31
 
@@ -26,7 +26,7 @@ module HTTPX
26
26
 
27
27
  def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses, bool early_resolve) -> void
28
28
 
29
- def initialize: (ip_family? family, options options) -> void
29
+ def initialize: (ip_family? family, Options options) -> void
30
30
 
31
31
  def early_resolve: (Connection connection, ?hostname: String) -> void
32
32
 
data/sig/response.rbs CHANGED
@@ -91,7 +91,7 @@ module HTTPX
91
91
 
92
92
  private
93
93
 
94
- def initialize: (Request, Exception, options) -> untyped
94
+ def initialize: (Request, Exception) -> untyped
95
95
  end
96
96
 
97
97
  type response = Response | ErrorResponse
data/sig/session.rbs CHANGED
@@ -15,7 +15,7 @@ module HTTPX
15
15
 
16
16
  def close: (*untyped) -> void
17
17
 
18
- def build_request: (verb, generic_uri, ?options) -> Request
18
+ def build_request: (verb verb, generic_uri uri, ?request_params params, ?Options options) -> Request
19
19
 
20
20
  def initialize: (?options) { (self) -> void } -> void
21
21
  | (?options) -> void
@@ -23,8 +23,11 @@ module HTTPX
23
23
  private
24
24
 
25
25
  def pool: -> Pool
26
+
26
27
  def on_response: (Request, response) -> void
28
+
27
29
  def on_promise: (untyped, untyped) -> void
30
+
28
31
  def fetch_response: (Request request, Array[Connection] connections, untyped options) -> response?
29
32
 
30
33
  def find_connection: (Request request, Array[Connection] connections, Options options) -> Connection
@@ -37,11 +40,11 @@ module HTTPX
37
40
 
38
41
  def build_altsvc_connection: (Connection existing_connection, Array[Connection] connections, URI::Generic alt_origin, String origin, Hash[String, String] alt_params, Options options) -> (Connection & AltSvc::ConnectionMixin)?
39
42
 
40
- def build_requests: (verb, uri, options) -> Array[Request]
41
- | (Array[[verb, uri, options]], options) -> Array[Request]
42
- | (Array[[verb, uri]], options) -> Array[Request]
43
- | (verb, _Each[[uri, options]], Options) -> Array[Request]
44
- | (verb, _Each[uri], options) -> Array[Request]
43
+ def build_requests: (verb, uri, request_params) -> Array[Request]
44
+ | (Array[[verb, uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
45
+ | (Array[[verb, uri]], request_params) -> Array[Request]
46
+ | (verb, _Each[[uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
47
+ | (verb, _Each[uri], request_params) -> Array[Request]
45
48
 
46
49
  def init_connection: (http_uri uri, Options options) -> Connection
47
50
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.3.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: 2024-06-17 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: http-2-next
14
+ name: http-2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.3
19
+ version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.3
26
+ version: 1.0.0
27
27
  description: A client library for making HTTP requests from Ruby.
28
28
  email:
29
29
  - cardoso_tiago@hotmail.com
@@ -144,6 +144,7 @@ extra_rdoc_files:
144
144
  - doc/release_notes/1_2_4.md
145
145
  - doc/release_notes/1_2_5.md
146
146
  - doc/release_notes/1_2_6.md
147
+ - doc/release_notes/1_3_0.md
147
148
  files:
148
149
  - LICENSE.txt
149
150
  - README.md
@@ -259,6 +260,7 @@ files:
259
260
  - doc/release_notes/1_2_4.md
260
261
  - doc/release_notes/1_2_5.md
261
262
  - doc/release_notes/1_2_6.md
263
+ - doc/release_notes/1_3_0.md
262
264
  - lib/httpx.rb
263
265
  - lib/httpx/adapters/datadog.rb
264
266
  - lib/httpx/adapters/faraday.rb