httpx 0.22.5 → 0.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes/0_23_0.md +42 -0
- data/doc/release_notes/0_23_1.md +5 -0
- data/lib/httpx/adapters/datadog.rb +1 -1
- data/lib/httpx/adapters/faraday.rb +1 -1
- data/lib/httpx/adapters/sentry.rb +4 -4
- data/lib/httpx/adapters/webmock.rb +2 -2
- data/lib/httpx/buffer.rb +4 -0
- data/lib/httpx/chainable.rb +4 -4
- data/lib/httpx/connection/http1.rb +2 -2
- data/lib/httpx/connection/http2.rb +2 -3
- data/lib/httpx/connection.rb +29 -10
- data/lib/httpx/io/udp.rb +2 -0
- data/lib/httpx/io/unix.rb +1 -5
- data/lib/httpx/io.rb +0 -10
- data/lib/httpx/options.rb +16 -2
- data/lib/httpx/plugins/authentication/digest.rb +1 -1
- data/lib/httpx/plugins/aws_sdk_authentication.rb +1 -3
- data/lib/httpx/plugins/aws_sigv4.rb +1 -1
- data/lib/httpx/plugins/compression/brotli.rb +4 -4
- data/lib/httpx/plugins/compression/deflate.rb +12 -7
- data/lib/httpx/plugins/compression/gzip.rb +7 -5
- data/lib/httpx/plugins/compression.rb +9 -8
- data/lib/httpx/plugins/digest_authentication.rb +1 -4
- data/lib/httpx/plugins/follow_redirects.rb +1 -1
- data/lib/httpx/plugins/grpc/message.rb +3 -1
- data/lib/httpx/plugins/grpc.rb +3 -3
- data/lib/httpx/plugins/h2c.rb +5 -9
- data/lib/httpx/plugins/internal_telemetry.rb +16 -0
- data/lib/httpx/plugins/multipart.rb +14 -2
- data/lib/httpx/plugins/proxy/http.rb +4 -4
- data/lib/httpx/plugins/proxy.rb +65 -31
- data/lib/httpx/plugins/response_cache.rb +2 -2
- data/lib/httpx/plugins/retries.rb +49 -2
- data/lib/httpx/plugins/upgrade/h2.rb +3 -3
- data/lib/httpx/plugins/upgrade.rb +4 -7
- data/lib/httpx/plugins/webdav.rb +7 -7
- data/lib/httpx/pool.rb +1 -1
- data/lib/httpx/request.rb +23 -13
- data/lib/httpx/resolver/https.rb +37 -20
- data/lib/httpx/resolver/native.rb +131 -35
- data/lib/httpx/resolver.rb +26 -14
- data/lib/httpx/response.rb +14 -16
- data/lib/httpx/session.rb +1 -0
- data/lib/httpx/transcoder/body.rb +0 -1
- data/lib/httpx/transcoder/chunker.rb +0 -1
- data/lib/httpx/transcoder/form.rb +0 -1
- data/lib/httpx/transcoder/json.rb +0 -1
- data/lib/httpx/transcoder/xml.rb +0 -1
- data/lib/httpx/transcoder.rb +0 -2
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +0 -1
- data/sig/buffer.rbs +1 -0
- data/sig/chainable.rbs +3 -3
- data/sig/connection.rbs +17 -6
- data/sig/errors.rbs +9 -0
- data/sig/httpx.rbs +3 -3
- data/sig/io/ssl.rbs +17 -0
- data/sig/io/tcp.rbs +57 -0
- data/sig/io/udp.rbs +20 -0
- data/sig/io/unix.rbs +10 -0
- data/sig/options.rbs +5 -1
- data/sig/plugins/compression.rbs +6 -2
- data/sig/plugins/cookies/jar.rbs +2 -2
- data/sig/plugins/grpc.rbs +3 -3
- data/sig/plugins/h2c.rbs +1 -1
- data/sig/plugins/proxy.rbs +1 -5
- data/sig/plugins/response_cache.rbs +1 -1
- data/sig/plugins/retries.rbs +28 -8
- data/sig/plugins/upgrade.rbs +5 -3
- data/sig/request.rbs +6 -2
- data/sig/resolver/https.rbs +3 -1
- data/sig/resolver/native.rbs +7 -2
- data/sig/resolver/resolver.rbs +0 -2
- data/sig/resolver/system.rbs +2 -0
- data/sig/resolver.rbs +8 -4
- data/sig/response.rbs +6 -2
- data/sig/session.rbs +10 -10
- data/sig/transcoder/xml.rbs +1 -1
- data/sig/transcoder.rbs +4 -5
- metadata +11 -5
- data/lib/httpx/registry.rb +0 -85
- data/sig/registry.rbs +0 -13
data/lib/httpx/registry.rb
DELETED
@@ -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
|