httpx 0.22.5 → 0.23.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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_23_0.md +42 -0
  3. data/lib/httpx/adapters/datadog.rb +1 -1
  4. data/lib/httpx/adapters/faraday.rb +1 -1
  5. data/lib/httpx/adapters/sentry.rb +4 -4
  6. data/lib/httpx/adapters/webmock.rb +2 -2
  7. data/lib/httpx/buffer.rb +4 -0
  8. data/lib/httpx/chainable.rb +4 -4
  9. data/lib/httpx/connection/http1.rb +2 -2
  10. data/lib/httpx/connection/http2.rb +2 -3
  11. data/lib/httpx/connection.rb +29 -10
  12. data/lib/httpx/io/udp.rb +2 -0
  13. data/lib/httpx/io/unix.rb +1 -5
  14. data/lib/httpx/io.rb +0 -10
  15. data/lib/httpx/options.rb +16 -2
  16. data/lib/httpx/plugins/authentication/digest.rb +1 -1
  17. data/lib/httpx/plugins/aws_sdk_authentication.rb +1 -3
  18. data/lib/httpx/plugins/aws_sigv4.rb +1 -1
  19. data/lib/httpx/plugins/compression/brotli.rb +4 -4
  20. data/lib/httpx/plugins/compression/deflate.rb +12 -7
  21. data/lib/httpx/plugins/compression/gzip.rb +7 -5
  22. data/lib/httpx/plugins/compression.rb +9 -8
  23. data/lib/httpx/plugins/digest_authentication.rb +1 -4
  24. data/lib/httpx/plugins/follow_redirects.rb +1 -1
  25. data/lib/httpx/plugins/grpc/message.rb +3 -1
  26. data/lib/httpx/plugins/grpc.rb +3 -3
  27. data/lib/httpx/plugins/h2c.rb +5 -9
  28. data/lib/httpx/plugins/internal_telemetry.rb +16 -0
  29. data/lib/httpx/plugins/multipart.rb +14 -2
  30. data/lib/httpx/plugins/proxy/http.rb +4 -4
  31. data/lib/httpx/plugins/proxy.rb +65 -31
  32. data/lib/httpx/plugins/response_cache.rb +2 -2
  33. data/lib/httpx/plugins/retries.rb +49 -2
  34. data/lib/httpx/plugins/upgrade/h2.rb +3 -3
  35. data/lib/httpx/plugins/upgrade.rb +4 -7
  36. data/lib/httpx/plugins/webdav.rb +7 -7
  37. data/lib/httpx/pool.rb +1 -1
  38. data/lib/httpx/request.rb +23 -13
  39. data/lib/httpx/resolver/https.rb +37 -20
  40. data/lib/httpx/resolver/native.rb +128 -36
  41. data/lib/httpx/resolver.rb +26 -14
  42. data/lib/httpx/response.rb +14 -16
  43. data/lib/httpx/session.rb +1 -0
  44. data/lib/httpx/transcoder/body.rb +0 -1
  45. data/lib/httpx/transcoder/chunker.rb +0 -1
  46. data/lib/httpx/transcoder/form.rb +0 -1
  47. data/lib/httpx/transcoder/json.rb +0 -1
  48. data/lib/httpx/transcoder/xml.rb +0 -1
  49. data/lib/httpx/transcoder.rb +0 -2
  50. data/lib/httpx/version.rb +1 -1
  51. data/lib/httpx.rb +0 -1
  52. data/sig/buffer.rbs +1 -0
  53. data/sig/chainable.rbs +3 -3
  54. data/sig/connection.rbs +17 -6
  55. data/sig/errors.rbs +9 -0
  56. data/sig/httpx.rbs +3 -3
  57. data/sig/io/ssl.rbs +17 -0
  58. data/sig/io/tcp.rbs +57 -0
  59. data/sig/io/udp.rbs +20 -0
  60. data/sig/io/unix.rbs +10 -0
  61. data/sig/options.rbs +5 -1
  62. data/sig/plugins/compression.rbs +6 -2
  63. data/sig/plugins/cookies/jar.rbs +2 -2
  64. data/sig/plugins/grpc.rbs +3 -3
  65. data/sig/plugins/h2c.rbs +1 -1
  66. data/sig/plugins/proxy.rbs +1 -5
  67. data/sig/plugins/response_cache.rbs +1 -1
  68. data/sig/plugins/retries.rbs +28 -8
  69. data/sig/plugins/upgrade.rbs +5 -3
  70. data/sig/request.rbs +6 -2
  71. data/sig/resolver/https.rbs +3 -1
  72. data/sig/resolver/native.rbs +7 -2
  73. data/sig/resolver/resolver.rbs +0 -2
  74. data/sig/resolver/system.rbs +2 -0
  75. data/sig/resolver.rbs +8 -4
  76. data/sig/response.rbs +6 -2
  77. data/sig/session.rbs +10 -10
  78. data/sig/transcoder/xml.rbs +1 -1
  79. data/sig/transcoder.rbs +4 -5
  80. metadata +9 -5
  81. data/lib/httpx/registry.rb +0 -85
  82. data/sig/registry.rbs +0 -13
@@ -1,85 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module HTTPX
4
- # Adds a general-purpose registry API to a class. It is designed to be a
5
- # configuration-level API, i.e. the registry is global to the class and
6
- # should be set on **boot time**.
7
- #
8
- # It is used internally to associate tags with handlers.
9
- #
10
- # ## Register/Fetch
11
- #
12
- # One is strongly advised to register handlers when creating the class.
13
- #
14
- # There is an instance-level method to retrieve from the registry based
15
- # on the tag:
16
- #
17
- # class Server
18
- # include HTTPX::Registry
19
- #
20
- # register "tcp", TCPHandler
21
- # register "ssl", SSLHandlers
22
- # ...
23
- #
24
- #
25
- # def handle(uri)
26
- # scheme = uri.scheme
27
- # handler = registry(scheme) #=> TCPHandler
28
- # handler.handle
29
- # end
30
- # end
31
- #
32
- module Registry
33
- # Base Registry Error
34
- class Error < Error; end
35
-
36
- def self.extended(klass)
37
- super
38
- klass.extend(ClassMethods)
39
- end
40
-
41
- def self.included(klass)
42
- super
43
- klass.extend(ClassMethods)
44
- klass.__send__(:include, InstanceMethods)
45
- end
46
-
47
- # Class Methods
48
- module ClassMethods
49
- def inherited(klass)
50
- super
51
- klass.instance_variable_set(:@registry, @registry.dup)
52
- end
53
-
54
- # @param [Object] tag the handler identifier in the registry
55
- # @return [Symbol, String, Object] the corresponding handler (if Symbol or String,
56
- # will assume it referes to an autoloaded module, and will load-and-return it).
57
- #
58
- def registry(tag = nil)
59
- @registry ||= {}
60
- return @registry if tag.nil?
61
-
62
- handler = @registry[tag]
63
- raise(Error, "#{tag} is not registered in #{self}") unless handler
64
-
65
- handler
66
- end
67
-
68
- # @param [Object] tag the identifier for the handler in the registry
69
- # @return [Symbol, String, Object] the handler (if Symbol or String, it is
70
- # assumed to be an autoloaded module, to be loaded later)
71
- #
72
- def register(tag, handler)
73
- registry[tag] = handler
74
- end
75
- end
76
-
77
- # Instance Methods
78
- module InstanceMethods
79
- # delegates to HTTPX::Registry#registry
80
- def registry(tag)
81
- self.class.registry(tag)
82
- end
83
- end
84
- end
85
- end
data/sig/registry.rbs DELETED
@@ -1,13 +0,0 @@
1
- module HTTPX::Registry[unchecked out T, unchecked out V]
2
- class Error < HTTPX::Error
3
- end
4
-
5
- # type registrable = Symbol | String | Class
6
-
7
- def self.registry: [T, V] (T) -> Class
8
- | [T, V] () -> Hash[T, V]
9
-
10
- def self.register: [T, V] (T tag, V handler) -> void
11
-
12
- def registry: (?T tag) -> V
13
- end