httpx 1.8.2 → 1.8.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c34100ea496b94c4dbcfcd95330a5c8fa21dd5997d49dff54f62ced363589f7f
4
- data.tar.gz: 24ef436a40b17cf4df3b2a9722c36437704c0c2ed1f5a1afc59b16801c36dbb4
3
+ metadata.gz: 5faeb9a08adff992ddd2661b4ccd5176cb2c49d17dbb6a0ea593e1a00c10f35b
4
+ data.tar.gz: 04f81429bbe03762c641531f0886c9b133f8fa04f8607943534ae36736f705e7
5
5
  SHA512:
6
- metadata.gz: 7796301721da3f362b4ec13bf5bffcdec864819dddf404dfb7c7ffadde69508de32e52b85e163b144d4ade6b3579aa256107680332a264b27cbe67fdd9e23875
7
- data.tar.gz: 63f47f3e7c9e50b720c8637dabc506fe30e79fb403e6d658646ff6fb894dc02774c8e1c2491d938392f1184d8f26f681361f9ffd1dec6675a622c03ba0441342
6
+ metadata.gz: e750874b2e206ff8604e804fa526847cc40c5511608d818c3a4a7c3136b383f5ca7c8baffbc856bd080ca0b77becc9ebc10d88e7743b5a757c7dd00b49a7e57c
7
+ data.tar.gz: 0e6e2f5aaf85be60d2fc044cad8ad7e215ae9a7768c11681f0ea5a5bcb264f3f7b8fb3aaf5a21bb2c94a8b03445ac26e0972e637ebc3a30d4f204238d79dbb96
@@ -0,0 +1,9 @@
1
+ # 1.8.3
2
+
3
+ ## Bugfixes
4
+
5
+ options print a warning instead of raising an error on unknown option
6
+
7
+ the approach introduced in the previous version, of erroring on something people have been accidentally relying on, is too strict in hindsight for a patch version. This was reverted, and instead, a deprecation warning will be printed, to give time for folks to migrate.
8
+
9
+ the format of options messages (exceptions and warnings) also slightly changes to wrap the option in quotes, for proper highlighting.
data/lib/httpx/options.rb CHANGED
@@ -133,12 +133,12 @@ module HTTPX
133
133
  when Options
134
134
  unknown_options = options.class.options_names - options_names
135
135
 
136
- raise Error, "unknown option: #{unknown_options.first}" unless unknown_options.empty?
136
+ raise Error, "unknown option: `:#{unknown_options.first}`" unless unknown_options.empty?
137
137
 
138
138
  DEFAULT_OPTIONS.merge(options)
139
139
  else
140
140
  options.each_key do |k|
141
- raise Error, "unknown option: #{k}" unless options_names.include?(k)
141
+ raise Error, "unknown option: `:#{k}`" unless options_names.include?(k)
142
142
  end
143
143
 
144
144
  options.empty? ? DEFAULT_OPTIONS : DEFAULT_OPTIONS.merge(options)
@@ -184,7 +184,7 @@ module HTTPX
184
184
  cache_type.respond_to?(:get) &&
185
185
  cache_type.respond_to?(:set) &&
186
186
  cache_type.respond_to?(:evict)
187
- raise TypeError, ":resolver_cache must be a compatible resolver cache and implement #get, #set and #evict"
187
+ raise TypeError, "`:resolver_cache` must be a compatible resolver cache and implement `#get`, `#set` and `#evict`"
188
188
  end
189
189
 
190
190
  cache_type #: Object & Resolver::_Cache
@@ -263,9 +263,14 @@ module HTTPX
263
263
  return self if other_opts.empty?
264
264
 
265
265
  return self if other_opts.all? do |opt, v|
266
- raise Error, "unknown option: #{opt}" unless respond_to?(opt)
266
+ unless respond_to?(opt)
267
+ # TODO: do this instead in a major or minor version bump
268
+ # raise Error, "unknown option: #{opt}" unless respond_to?(opt)
269
+ warn "DEPRECATION WARNING: unknown option: `:#{opt}`. an exception will be raised in a future version."
270
+ next(true)
271
+ end
267
272
 
268
- public_send(opt) == v
273
+ !respond_to?(opt) || public_send(opt) == v
269
274
  end
270
275
  end
271
276
 
@@ -404,7 +409,7 @@ module HTTPX
404
409
  # converts +v+ into an Integer before setting the +#{option}+ option.
405
410
  private def option_#{option}(value) # private def option_max_requests(v)
406
411
  value = Integer(value) unless value.respond_to?(:infinite?) && value.infinite?
407
- raise TypeError, ":#{option} must be positive" unless value.positive? # raise TypeError, ":max_requests must be positive" unless value.positive?
412
+ raise TypeError, "`:#{option}` must be positive" unless value.positive? # raise TypeError, ":max_requests must be positive" unless value.positive?
408
413
 
409
414
  value
410
415
  end
@@ -456,11 +461,11 @@ module HTTPX
456
461
 
457
462
  # Validate keys and values
458
463
  timeout_hash.each do |key, val|
459
- raise TypeError, "invalid timeout: :#{key}" unless default_timeouts.key?(key)
464
+ raise TypeError, "invalid timeout: `:#{key}`" unless default_timeouts.key?(key)
460
465
 
461
466
  next if val.nil?
462
467
 
463
- raise TypeError, ":#{key} must be numeric" unless val.is_a?(Numeric)
468
+ raise TypeError, "`:#{key}` must be numeric" unless val.is_a?(Numeric)
464
469
  end
465
470
 
466
471
  timeout_hash
@@ -490,15 +495,15 @@ module HTTPX
490
495
  when Symbol
491
496
  meth = :"resolver_#{resolver_type}_class"
492
497
 
493
- raise TypeError, ":resolver_class must be a supported type" unless respond_to?(meth)
498
+ raise TypeError, "`:resolver_class` must be a supported type" unless respond_to?(meth)
494
499
 
495
500
  resolver_type
496
501
  when Class
497
- raise TypeError, ":resolver_class must be a subclass of `#{Resolver::Resolver}`" unless resolver_type < Resolver::Resolver
502
+ raise TypeError, "`:resolver_class` must be a subclass of `#{Resolver::Resolver}`" unless resolver_type < Resolver::Resolver
498
503
 
499
504
  resolver_type
500
505
  else
501
- raise TypeError, ":resolver_class must be a supported type"
506
+ raise TypeError, "`:resolver_class` must be a supported type"
502
507
  end
503
508
  end
504
509
 
@@ -513,7 +518,7 @@ module HTTPX
513
518
  cache_type.respond_to?(:get) &&
514
519
  cache_type.respond_to?(:set) &&
515
520
  cache_type.respond_to?(:evict)
516
- raise TypeError, ":resolver_cache must be a compatible resolver cache and implement #resolve, #get, #set and #evict"
521
+ raise TypeError, "`:resolver_cache` must be a compatible resolver cache and implement `#resolve`, `#get`, `#set` and `#evict`"
517
522
  end
518
523
  end
519
524
 
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.8.2"
4
+ VERSION = "1.8.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -171,6 +171,7 @@ extra_rdoc_files:
171
171
  - doc/release_notes/1_8_0.md
172
172
  - doc/release_notes/1_8_1.md
173
173
  - doc/release_notes/1_8_2.md
174
+ - doc/release_notes/1_8_3.md
174
175
  files:
175
176
  - LICENSE.txt
176
177
  - README.md
@@ -314,6 +315,7 @@ files:
314
315
  - doc/release_notes/1_8_0.md
315
316
  - doc/release_notes/1_8_1.md
316
317
  - doc/release_notes/1_8_2.md
318
+ - doc/release_notes/1_8_3.md
317
319
  - lib/httpx.rb
318
320
  - lib/httpx/adapters/datadog.rb
319
321
  - lib/httpx/adapters/faraday.rb