httpx 0.24.5 → 0.24.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3d9a59fa9d9cc1908f3135c38d9a8cb132312c0539795d3a341d87da3755d23
4
- data.tar.gz: 8e88ca75fceac380b8fbb31fa627f3a30a2b938e2527baffbc2db00db64b76e5
3
+ metadata.gz: 06e8fd5ae58c24b0e8d71267133209622fad2e16e2196403937f3d330330fc72
4
+ data.tar.gz: 2684eb339c078326609390667a8c9522225fdf56ff2fdece7571022c110d96fc
5
5
  SHA512:
6
- metadata.gz: fe80712332209f6b188eca10aea16f0d1cb02b8af18682e6efda3844cd5d5de9e99cb0829cf162433fe85f7a070865808caa32a69df3ebe84b7dd483c105315f
7
- data.tar.gz: 1ec1dd55a8ec80bceaab32a39dfa2e325f01f83c5e512be5c74feb8f4049ef9f34431ab6d33d00ad4b6fcf906d7883a0420e91a0663f2eb4fdd6ddb632b4d351
6
+ metadata.gz: fc776c73232482381b6c8861cd6b743b16e2ccd03a8aa2764ccb30668c6e13ca3a560b51d66f0569cbf1f0d71c2ad101ad04e3b1c187336496b6424633b12e41
7
+ data.tar.gz: aaa3cbf6a87825896331a2cd0aa2604e82738510507cade210092fcbb060456765750ed3e13af1395fc1cc998abf0c6222eda776f27d152e9e46c406ed3cce4d
@@ -0,0 +1,5 @@
1
+ # 0.24.6
2
+
3
+ ## Bugfixes
4
+
5
+ * fix Session class assertions not prepared for class overrides, which could break some plugins which override the Session class on load (such as `datadog` or `webmock` adapters).
@@ -0,0 +1,10 @@
1
+ # 0.24.6
2
+
3
+ ## dependencies
4
+
5
+ `http-2-next` last supported version for the 0.x series is the last version before v1. This shoul ensure that older versions of `httpx` won't be affected by any of the recent breaking changes.
6
+
7
+ ## Bugfixes
8
+
9
+ * `grpc`: setup of rpc calls from camel-cased symbols has been fixed. As an improvement, the GRPC-enabled session will now support both snake-cased, as well as camel-cased calls.
10
+ * `datadog` adapter has now been patched to support the most recent breaking changes of `ddtrace` configuration DSL (`env_to_bool` is no longer supported).
@@ -188,19 +188,39 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
188
188
  option :distributed_tracing, default: true
189
189
  option :split_by_domain, default: false
190
190
 
191
- option :enabled do |o|
192
- o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
193
- o.lazy
194
- end
191
+ if DDTrace::VERSION::STRING >= "1.13.0"
192
+ option :enabled do |o|
193
+ o.type :bool
194
+ o.env "DD_TRACE_HTTPX_ENABLED"
195
+ o.default true
196
+ end
195
197
 
196
- option :analytics_enabled do |o|
197
- o.default { env_to_bool(%w[DD_TRACE_HTTPX_ANALYTICS_ENABLED DD_HTTPX_ANALYTICS_ENABLED], false) }
198
- o.lazy
199
- end
198
+ option :analytics_enabled do |o|
199
+ o.type :bool
200
+ o.env "DD_TRACE_HTTPX_ANALYTICS_ENABLED"
201
+ o.default false
202
+ end
203
+
204
+ option :analytics_sample_rate do |o|
205
+ o.type :float
206
+ o.env "DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE"
207
+ o.default 1.0
208
+ end
209
+ else
210
+ option :enabled do |o|
211
+ o.default { env_to_bool("DD_TRACE_HTTPX_ENABLED", true) }
212
+ o.lazy
213
+ end
200
214
 
201
- option :analytics_sample_rate do |o|
202
- o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
203
- o.lazy
215
+ option :analytics_enabled do |o|
216
+ o.default { env_to_bool(%w[DD_TRACE_HTTPX_ANALYTICS_ENABLED DD_HTTPX_ANALYTICS_ENABLED], false) }
217
+ o.lazy
218
+ end
219
+
220
+ option :analytics_sample_rate do |o|
221
+ o.default { env_to_float(%w[DD_TRACE_HTTPX_ANALYTICS_SAMPLE_RATE DD_HTTPX_ANALYTICS_SAMPLE_RATE], 1.0) }
222
+ o.lazy
223
+ end
204
224
  end
205
225
 
206
226
  if defined?(TRACING_MODULE::Contrib::SpanAttributeSchema)
@@ -224,7 +244,19 @@ module TRACING_MODULE # rubocop:disable Naming/ClassAndModuleCamelCase
224
244
 
225
245
  option :distributed_tracing, default: true
226
246
 
227
- option :error_handler, default: DEFAULT_ERROR_HANDLER
247
+ if DDTrace::VERSION::STRING >= "1.15.0"
248
+ option :error_handler do |o|
249
+ o.type :proc
250
+ o.default_proc(&DEFAULT_ERROR_HANDLER)
251
+ end
252
+ elsif DDTrace::VERSION::STRING >= "1.13.0"
253
+ option :error_handler do |o|
254
+ o.type :proc
255
+ o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
256
+ end
257
+ else
258
+ option :error_handler, default: DEFAULT_ERROR_HANDLER
259
+ end
228
260
  end
229
261
  end
230
262
 
@@ -48,7 +48,7 @@ module HTTPX
48
48
  end
49
49
 
50
50
  def plugin(pl, options = nil, &blk)
51
- klass = is_a?(Session) ? self.class : Session
51
+ klass = is_a?(S) ? self.class : Session
52
52
  klass = Class.new(klass)
53
53
  klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
54
54
  klass.plugin(pl, options, &blk).new
@@ -58,7 +58,7 @@ module HTTPX
58
58
  # :nocov:
59
59
  def plugins(pls)
60
60
  warn ":#{__method__} is deprecated, use :plugin instead"
61
- klass = is_a?(Session) ? self.class : Session
61
+ klass = is_a?(S) ? self.class : Session
62
62
  klass = Class.new(klass)
63
63
  klass.instance_variable_set(:@default_options, klass.default_options.merge(default_options))
64
64
  klass.plugins(pls).new
@@ -82,7 +82,7 @@ module HTTPX
82
82
  end
83
83
 
84
84
  def branch(options, &blk)
85
- return self.class.new(options, &blk) if is_a?(Session)
85
+ return self.class.new(options, &blk) if is_a?(S)
86
86
 
87
87
  Session.new(options, &blk)
88
88
  end
@@ -141,17 +141,29 @@ module HTTPX
141
141
  deadline: @options.grpc_deadline,
142
142
  }.merge(opts)
143
143
 
144
+ local_rpc_name = rpc_name.underscore
145
+
144
146
  session_class = Class.new(self.class) do
147
+ # define rpc method with ruby style name
145
148
  class_eval(<<-OUT, __FILE__, __LINE__ + 1)
146
- def #{rpc_name}(input, **opts) # def grpc_action(input, **opts)
147
- rpc_execute("#{rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
148
- end # end
149
+ def #{local_rpc_name}(input, **opts) # def grpc_action(input, **opts)
150
+ rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
151
+ end # end
149
152
  OUT
153
+
154
+ # define rpc method with original name
155
+ unless local_rpc_name == rpc_name
156
+ class_eval(<<-OUT, __FILE__, __LINE__ + 1)
157
+ def #{rpc_name}(input, **opts) # def grpcAction(input, **opts)
158
+ rpc_execute("#{local_rpc_name}", input, **opts) # rpc_execute("grpc_action", input, **opts)
159
+ end # end
160
+ OUT
161
+ end
150
162
  end
151
163
 
152
164
  session_class.new(@options.merge(
153
165
  grpc_rpcs: @options.grpc_rpcs.merge(
154
- rpc_name.underscore => [rpc_name, input, output, rpc_opts]
166
+ local_rpc_name => [rpc_name, input, output, rpc_opts]
155
167
  ).freeze
156
168
  ))
157
169
  end
data/lib/httpx/session.rb CHANGED
@@ -351,4 +351,7 @@ module HTTPX
351
351
  # :nocov:
352
352
  end
353
353
  end
354
+
355
+ # session may be overridden by certain adapters.
356
+ S = Session
354
357
  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 = "0.24.5"
4
+ VERSION = "0.24.7"
5
5
  end
data/sig/session.rbs CHANGED
@@ -51,4 +51,6 @@ module HTTPX
51
51
 
52
52
  attr_reader self.default_options: Options
53
53
  end
54
+
55
+ OriginalSession: singleton(Session)
54
56
  end
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: 0.24.5
4
+ version: 0.24.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-17 00:00:00.000000000 Z
11
+ date: 2023-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.1
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: 0.4.1
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
@@ -105,6 +105,8 @@ extra_rdoc_files:
105
105
  - doc/release_notes/0_24_3.md
106
106
  - doc/release_notes/0_24_4.md
107
107
  - doc/release_notes/0_24_5.md
108
+ - doc/release_notes/0_24_6.md
109
+ - doc/release_notes/0_24_7.md
108
110
  - doc/release_notes/0_2_0.md
109
111
  - doc/release_notes/0_2_1.md
110
112
  - doc/release_notes/0_3_0.md
@@ -202,6 +204,8 @@ files:
202
204
  - doc/release_notes/0_24_3.md
203
205
  - doc/release_notes/0_24_4.md
204
206
  - doc/release_notes/0_24_5.md
207
+ - doc/release_notes/0_24_6.md
208
+ - doc/release_notes/0_24_7.md
205
209
  - doc/release_notes/0_2_0.md
206
210
  - doc/release_notes/0_2_1.md
207
211
  - doc/release_notes/0_3_0.md