httpx 0.22.5 → 0.23.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes/0_23_0.md +42 -0
  3. data/doc/release_notes/0_23_1.md +5 -0
  4. data/lib/httpx/adapters/datadog.rb +1 -1
  5. data/lib/httpx/adapters/faraday.rb +1 -1
  6. data/lib/httpx/adapters/sentry.rb +4 -4
  7. data/lib/httpx/adapters/webmock.rb +2 -2
  8. data/lib/httpx/buffer.rb +4 -0
  9. data/lib/httpx/chainable.rb +4 -4
  10. data/lib/httpx/connection/http1.rb +2 -2
  11. data/lib/httpx/connection/http2.rb +2 -3
  12. data/lib/httpx/connection.rb +29 -10
  13. data/lib/httpx/io/udp.rb +2 -0
  14. data/lib/httpx/io/unix.rb +1 -5
  15. data/lib/httpx/io.rb +0 -10
  16. data/lib/httpx/options.rb +16 -2
  17. data/lib/httpx/plugins/authentication/digest.rb +1 -1
  18. data/lib/httpx/plugins/aws_sdk_authentication.rb +1 -3
  19. data/lib/httpx/plugins/aws_sigv4.rb +1 -1
  20. data/lib/httpx/plugins/compression/brotli.rb +4 -4
  21. data/lib/httpx/plugins/compression/deflate.rb +12 -7
  22. data/lib/httpx/plugins/compression/gzip.rb +7 -5
  23. data/lib/httpx/plugins/compression.rb +9 -8
  24. data/lib/httpx/plugins/digest_authentication.rb +1 -4
  25. data/lib/httpx/plugins/follow_redirects.rb +1 -1
  26. data/lib/httpx/plugins/grpc/message.rb +3 -1
  27. data/lib/httpx/plugins/grpc.rb +3 -3
  28. data/lib/httpx/plugins/h2c.rb +5 -9
  29. data/lib/httpx/plugins/internal_telemetry.rb +16 -0
  30. data/lib/httpx/plugins/multipart.rb +14 -2
  31. data/lib/httpx/plugins/proxy/http.rb +4 -4
  32. data/lib/httpx/plugins/proxy.rb +65 -31
  33. data/lib/httpx/plugins/response_cache.rb +2 -2
  34. data/lib/httpx/plugins/retries.rb +49 -2
  35. data/lib/httpx/plugins/upgrade/h2.rb +3 -3
  36. data/lib/httpx/plugins/upgrade.rb +4 -7
  37. data/lib/httpx/plugins/webdav.rb +7 -7
  38. data/lib/httpx/pool.rb +1 -1
  39. data/lib/httpx/request.rb +23 -13
  40. data/lib/httpx/resolver/https.rb +37 -20
  41. data/lib/httpx/resolver/native.rb +131 -35
  42. data/lib/httpx/resolver.rb +26 -14
  43. data/lib/httpx/response.rb +14 -16
  44. data/lib/httpx/session.rb +1 -0
  45. data/lib/httpx/transcoder/body.rb +0 -1
  46. data/lib/httpx/transcoder/chunker.rb +0 -1
  47. data/lib/httpx/transcoder/form.rb +0 -1
  48. data/lib/httpx/transcoder/json.rb +0 -1
  49. data/lib/httpx/transcoder/xml.rb +0 -1
  50. data/lib/httpx/transcoder.rb +0 -2
  51. data/lib/httpx/version.rb +1 -1
  52. data/lib/httpx.rb +0 -1
  53. data/sig/buffer.rbs +1 -0
  54. data/sig/chainable.rbs +3 -3
  55. data/sig/connection.rbs +17 -6
  56. data/sig/errors.rbs +9 -0
  57. data/sig/httpx.rbs +3 -3
  58. data/sig/io/ssl.rbs +17 -0
  59. data/sig/io/tcp.rbs +57 -0
  60. data/sig/io/udp.rbs +20 -0
  61. data/sig/io/unix.rbs +10 -0
  62. data/sig/options.rbs +5 -1
  63. data/sig/plugins/compression.rbs +6 -2
  64. data/sig/plugins/cookies/jar.rbs +2 -2
  65. data/sig/plugins/grpc.rbs +3 -3
  66. data/sig/plugins/h2c.rbs +1 -1
  67. data/sig/plugins/proxy.rbs +1 -5
  68. data/sig/plugins/response_cache.rbs +1 -1
  69. data/sig/plugins/retries.rbs +28 -8
  70. data/sig/plugins/upgrade.rbs +5 -3
  71. data/sig/request.rbs +6 -2
  72. data/sig/resolver/https.rbs +3 -1
  73. data/sig/resolver/native.rbs +7 -2
  74. data/sig/resolver/resolver.rbs +0 -2
  75. data/sig/resolver/system.rbs +2 -0
  76. data/sig/resolver.rbs +8 -4
  77. data/sig/response.rbs +6 -2
  78. data/sig/session.rbs +10 -10
  79. data/sig/transcoder/xml.rbs +1 -1
  80. data/sig/transcoder.rbs +4 -5
  81. metadata +11 -5
  82. data/lib/httpx/registry.rb +0 -85
  83. 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