httpx 0.15.1 → 0.16.0
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_15_2.md +9 -0
- data/doc/release_notes/0_15_3.md +5 -0
- data/doc/release_notes/0_15_4.md +5 -0
- data/doc/release_notes/0_16_0.md +93 -0
- data/lib/httpx.rb +6 -3
- data/lib/httpx/adapters/faraday.rb +3 -11
- data/lib/httpx/buffer.rb +1 -1
- data/lib/httpx/callbacks.rb +1 -1
- data/lib/httpx/chainable.rb +15 -8
- data/lib/httpx/connection.rb +2 -2
- data/lib/httpx/connection/http1.rb +3 -1
- data/lib/httpx/connection/http2.rb +1 -11
- data/lib/httpx/errors.rb +11 -11
- data/lib/httpx/io/ssl.rb +2 -2
- data/lib/httpx/io/tls.rb +1 -1
- data/lib/httpx/loggable.rb +1 -1
- data/lib/httpx/options.rb +81 -74
- data/lib/httpx/parser/http1.rb +1 -1
- data/lib/httpx/plugins/aws_sigv4.rb +10 -9
- data/lib/httpx/plugins/compression.rb +12 -11
- data/lib/httpx/plugins/cookies.rb +20 -7
- data/lib/httpx/plugins/cookies/cookie.rb +4 -3
- data/lib/httpx/plugins/cookies/jar.rb +24 -1
- data/lib/httpx/plugins/digest_authentication.rb +15 -11
- data/lib/httpx/plugins/expect.rb +19 -15
- data/lib/httpx/plugins/follow_redirects.rb +9 -9
- data/lib/httpx/plugins/grpc.rb +73 -47
- data/lib/httpx/plugins/grpc/call.rb +4 -1
- data/lib/httpx/plugins/ntlm_authentication.rb +8 -6
- data/lib/httpx/plugins/proxy.rb +4 -6
- data/lib/httpx/plugins/proxy/socks4.rb +2 -1
- data/lib/httpx/plugins/proxy/socks5.rb +2 -1
- data/lib/httpx/plugins/proxy/ssh.rb +9 -9
- data/lib/httpx/plugins/retries.rb +25 -21
- data/lib/httpx/plugins/upgrade.rb +7 -6
- data/lib/httpx/registry.rb +1 -1
- data/lib/httpx/request.rb +4 -12
- data/lib/httpx/resolver/https.rb +0 -2
- data/lib/httpx/response.rb +45 -18
- data/lib/httpx/selector.rb +13 -12
- data/lib/httpx/session.rb +19 -8
- data/lib/httpx/session2.rb +21 -0
- data/lib/httpx/transcoder/body.rb +1 -1
- data/lib/httpx/transcoder/chunker.rb +2 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/buffer.rbs +2 -0
- data/sig/chainable.rbs +24 -28
- data/sig/connection.rbs +20 -8
- data/sig/connection/http1.rbs +3 -3
- data/sig/connection/http2.rbs +1 -1
- data/sig/errors.rbs +35 -1
- data/sig/headers.rbs +5 -5
- data/sig/httpx.rbs +4 -1
- data/sig/loggable.rbs +3 -1
- data/sig/options.rbs +35 -32
- data/sig/plugins/authentication.rbs +1 -1
- data/sig/plugins/aws_sdk_authentication.rbs +5 -1
- data/sig/plugins/aws_sigv4.rbs +1 -2
- data/sig/plugins/basic_authentication.rbs +1 -1
- data/sig/plugins/compression.rbs +4 -6
- data/sig/plugins/cookies.rbs +4 -5
- data/sig/plugins/cookies/cookie.rbs +5 -7
- data/sig/plugins/cookies/jar.rbs +9 -10
- data/sig/plugins/digest_authentication.rbs +2 -3
- data/sig/plugins/expect.rbs +2 -4
- data/sig/plugins/follow_redirects.rbs +3 -5
- data/sig/plugins/grpc.rbs +4 -7
- data/sig/plugins/h2c.rbs +0 -2
- data/sig/plugins/multipart.rbs +2 -4
- data/sig/plugins/ntlm_authentication.rbs +2 -3
- data/sig/plugins/persistent.rbs +3 -8
- data/sig/plugins/proxy.rbs +7 -7
- data/sig/plugins/proxy/ssh.rbs +4 -4
- data/sig/plugins/push_promise.rbs +0 -2
- data/sig/plugins/retries.rbs +4 -8
- data/sig/plugins/stream.rbs +1 -1
- data/sig/plugins/upgrade.rbs +2 -3
- data/sig/pool.rbs +1 -2
- data/sig/registry.rbs +1 -1
- data/sig/request.rbs +2 -2
- data/sig/resolver.rbs +7 -0
- data/sig/resolver/native.rbs +9 -5
- data/sig/resolver/resolver_mixin.rbs +4 -5
- data/sig/resolver/system.rbs +2 -0
- data/sig/response.rbs +17 -11
- data/sig/selector.rbs +7 -6
- data/sig/session.rbs +19 -14
- data/sig/transcoder.rbs +11 -4
- data/sig/transcoder/body.rbs +6 -1
- data/sig/transcoder/chunker.rbs +8 -2
- data/sig/transcoder/form.rbs +2 -1
- data/sig/transcoder/json.rbs +1 -0
- data/sig/utils.rbs +2 -0
- metadata +12 -2
@@ -3,6 +3,10 @@ module HTTPX
|
|
3
3
|
module AwsSdkAuthentication
|
4
4
|
class Credentials
|
5
5
|
include _SigV4Credentials
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def initialize: (untyped aws_credentials) -> untyped
|
6
10
|
end
|
7
11
|
|
8
12
|
def self.load_dependencies: (singleton(Session)) -> void
|
@@ -16,6 +20,6 @@ module HTTPX
|
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
19
|
-
type sessionAwsSdkAuthentication = Session &
|
23
|
+
type sessionAwsSdkAuthentication = Session & AwsSdkAuthentication::InstanceMethods
|
20
24
|
end
|
21
25
|
end
|
data/sig/plugins/aws_sigv4.rbs
CHANGED
@@ -42,7 +42,6 @@ module HTTPX
|
|
42
42
|
|
43
43
|
interface _SigV4Options
|
44
44
|
def sigv4_signer: () -> Signer?
|
45
|
-
def sigv4_signer=: (Signer) -> Signer
|
46
45
|
end
|
47
46
|
|
48
47
|
def self.extra_options: (Options) -> (Options & _SigV4Options)
|
@@ -59,6 +58,6 @@ module HTTPX
|
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
62
|
-
type awsSigV4Session = Session &
|
61
|
+
type awsSigV4Session = Session & AWSSigV4::InstanceMethods
|
63
62
|
end
|
64
63
|
end
|
data/sig/plugins/compression.rbs
CHANGED
@@ -15,23 +15,21 @@ module HTTPX
|
|
15
15
|
|
16
16
|
def initialize: (Numeric bytesize) -> untyped
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def self.configure: (singleton(Session)) -> void
|
20
20
|
|
21
21
|
interface _CompressionOptions
|
22
|
-
def compression_threshold_size: () ->
|
23
|
-
def compression_threshold_size=: (int) -> int
|
22
|
+
def compression_threshold_size: () -> Integer?
|
24
23
|
|
25
24
|
def encodings: () -> encodings_registry?
|
26
|
-
def encodings=: (encodings_registry) -> encodings_registry
|
27
25
|
end
|
28
|
-
|
26
|
+
|
29
27
|
def self.extra_options: (Options) -> (Options & _CompressionOptions)
|
30
28
|
|
31
29
|
|
32
30
|
module ResponseBodyMethods
|
33
31
|
@encodings: Array[String]
|
34
|
-
@_deflaters: Array[
|
32
|
+
@_deflaters: Array[_Deflater]
|
35
33
|
|
36
34
|
private
|
37
35
|
|
data/sig/plugins/cookies.rbs
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module Cookies
|
4
|
-
type jar = Jar | _Each[
|
4
|
+
type jar = Jar | _Each[Jar::cookie]
|
5
5
|
|
6
6
|
interface _CookieOptions
|
7
7
|
def cookies: () -> Jar?
|
8
|
-
def cookies=: (jar) -> Jar
|
9
8
|
end
|
10
|
-
|
9
|
+
|
11
10
|
def self.extra_options: (Options) -> (Options & _CookieOptions)
|
12
11
|
|
13
12
|
module InstanceMethods
|
@@ -19,7 +18,7 @@ module HTTPX
|
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
|
-
type sessionCookies = Session &
|
23
|
-
type headersCookies = Headers &
|
21
|
+
type sessionCookies = Session & Cookies::InstanceMethods
|
22
|
+
type headersCookies = Headers & Cookies::HeadersMethods
|
24
23
|
end
|
25
24
|
end
|
@@ -31,19 +31,17 @@ module HTTPX
|
|
31
31
|
|
32
32
|
def valid_for_uri?: (uri) -> bool
|
33
33
|
|
34
|
-
def self.new: (Cookie) ->
|
35
|
-
| (cookie_attributes) ->
|
36
|
-
| (
|
37
|
-
| (String, String, cookie_attributes) -> untyped
|
34
|
+
def self.new: (Cookie) -> instance
|
35
|
+
| (cookie_attributes) -> instance
|
36
|
+
| (_ToS, _ToS, ?cookie_attributes) -> instance
|
38
37
|
|
39
38
|
def self.path_match?: (String, String) -> bool
|
40
39
|
|
41
40
|
private
|
42
41
|
|
43
42
|
def initialize: (cookie_attributes) -> untyped
|
44
|
-
| (
|
45
|
-
|
46
|
-
|
43
|
+
| (_ToS, _ToS, ?cookie_attributes) -> untyped
|
44
|
+
|
47
45
|
def acceptable_from_uri?: (uri) -> bool
|
48
46
|
end
|
49
47
|
end
|
data/sig/plugins/cookies/jar.rbs
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins::Cookies
|
3
3
|
class Jar
|
4
|
-
type cookie = Cookie | Array[String, String, cookie_attributes] | Array[String, String] | cookie_attributes
|
4
|
+
type cookie = Cookie | Array[[String, String, cookie_attributes]] | Array[[String, String]] | cookie_attributes
|
5
5
|
|
6
6
|
include Enumerable[Cookie]
|
7
7
|
|
8
8
|
@cookies: Array[Cookie]
|
9
9
|
|
10
|
-
def parse: (String) -> void
|
10
|
+
def parse: (String set_cookie) -> void
|
11
11
|
|
12
|
-
def add: (Cookie) -> void
|
13
|
-
| (Cookie, String) -> void
|
12
|
+
def add: (Cookie name, ?String path) -> void
|
14
13
|
|
15
14
|
def []: (uri) -> Array[Cookie]
|
16
15
|
|
17
|
-
def each: (uri) { (Cookie) -> void } -> void
|
18
|
-
| (uri) -> Enumerable[Cookie]
|
19
|
-
|
20
|
-
|
16
|
+
def each: (?uri) { (Cookie) -> void } -> void
|
17
|
+
| (?uri) -> Enumerable[Cookie]
|
18
|
+
|
19
|
+
def merge: (_Each[cookie] cookies) -> instance
|
20
|
+
|
21
21
|
private
|
22
22
|
|
23
|
-
def initialize: () ->
|
24
|
-
| (_Each[cookie]) -> untyped
|
23
|
+
def initialize: (?_Each[cookie] cookies) -> untyped
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
@@ -5,9 +5,8 @@ module HTTPX
|
|
5
5
|
|
6
6
|
interface _DigestOptions
|
7
7
|
def digest: () -> Digest?
|
8
|
-
def digest=: (Digest) -> Digest
|
9
8
|
end
|
10
|
-
|
9
|
+
|
11
10
|
def self.extra_options: (Options) -> (Options & _DigestOptions)
|
12
11
|
|
13
12
|
def self.load_dependencies: (*untyped) -> void
|
@@ -27,6 +26,6 @@ module HTTPX
|
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
|
-
type sessionDigestAuthentication =
|
29
|
+
type sessionDigestAuthentication = sessionAuthentication & DigestAuthentication::InstanceMethods
|
31
30
|
end
|
32
31
|
end
|
data/sig/plugins/expect.rbs
CHANGED
@@ -2,15 +2,13 @@ module HTTPX
|
|
2
2
|
module Plugins
|
3
3
|
module Expect
|
4
4
|
EXPECT_TIMEOUT: Integer
|
5
|
-
|
5
|
+
|
6
6
|
interface _ExpectOptions
|
7
7
|
def expect_timeout: () -> Integer?
|
8
|
-
def expect_timeout=: (int) -> Integer
|
9
8
|
|
10
9
|
def expect_threshold_size: () -> Integer?
|
11
|
-
def expect_threshold_size=: (int) -> Integer
|
12
10
|
end
|
13
|
-
|
11
|
+
|
14
12
|
def self.extra_options: (Options) -> (Options & _ExpectOptions)
|
15
13
|
end
|
16
14
|
end
|
@@ -5,15 +5,13 @@ module HTTPX
|
|
5
5
|
module FollowRedirects
|
6
6
|
MAX_REDIRECTS: Integer
|
7
7
|
REDIRECT_STATUS: Range[Integer]
|
8
|
-
|
8
|
+
|
9
9
|
interface _FollowRedirectsOptions
|
10
10
|
def max_redirects: () -> Integer?
|
11
|
-
def max_redirects=: (int) -> Integer
|
12
11
|
|
13
12
|
def follow_insecure_redirects: () -> bool?
|
14
|
-
def follow_insecure_redirects=: (bool) -> bool
|
15
13
|
end
|
16
|
-
|
14
|
+
|
17
15
|
def self.extra_options: (Options) -> (Options & _FollowRedirectsOptions)
|
18
16
|
|
19
17
|
module InstanceMethods
|
@@ -30,6 +28,6 @@ module HTTPX
|
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
33
|
-
type sessionFollowRedirects = Session &
|
31
|
+
type sessionFollowRedirects = Session & FollowRedirects::InstanceMethods
|
34
32
|
end
|
35
33
|
end
|
data/sig/plugins/grpc.rbs
CHANGED
@@ -15,6 +15,8 @@ module HTTPX
|
|
15
15
|
type grpc_request = untyped | _Each[untyped]
|
16
16
|
type grpc_response = untyped | _Each[untyped]
|
17
17
|
|
18
|
+
type credentials = Proc
|
19
|
+
|
18
20
|
class Call
|
19
21
|
attr_writer decoder: _Callable
|
20
22
|
|
@@ -39,7 +41,7 @@ module HTTPX
|
|
39
41
|
|
40
42
|
def self?.decode: (String message, encodings: Array[String], encoders: Compression::encodings_registry) -> String
|
41
43
|
| (String message, encodings: Array[String], encoders: Compression::encodings_registry) { (String) -> void } -> void
|
42
|
-
|
44
|
+
|
43
45
|
def self?.cancel: (Request) -> void
|
44
46
|
|
45
47
|
def self?.verify_status: (StreamResponse | response) -> void
|
@@ -47,19 +49,14 @@ module HTTPX
|
|
47
49
|
|
48
50
|
interface _GRPCOptions
|
49
51
|
def grpc_service: () -> String?
|
50
|
-
def grpc_service=: (string) -> String
|
51
52
|
|
52
53
|
def grpc_compression: () -> compression_option?
|
53
|
-
def grpc_compression=: (compression_option) -> compression_option
|
54
54
|
|
55
55
|
def grpc_rpcs: () -> Hash[String, rpc_def]?
|
56
|
-
def grpc_rpcs=: (Hash[String, rpc_def]) -> Hash[String, rpc_def]
|
57
56
|
|
58
57
|
def grpc_deadline: () -> Integer?
|
59
|
-
def grpc_deadline=: (Integer) -> Integer
|
60
58
|
|
61
59
|
def call_credentials: () -> credentials?
|
62
|
-
def call_credentials=: (credentials) -> credentials
|
63
60
|
end
|
64
61
|
|
65
62
|
def self.extra_options: (Options) -> (Options & _GRPCOptions)
|
@@ -88,6 +85,6 @@ module HTTPX
|
|
88
85
|
end
|
89
86
|
end
|
90
87
|
|
91
|
-
type grpcSession = Session &
|
88
|
+
type grpcSession = Session & GRPC::InstanceMethods
|
92
89
|
end
|
93
90
|
end
|
data/sig/plugins/h2c.rbs
CHANGED
data/sig/plugins/multipart.rbs
CHANGED
@@ -13,8 +13,6 @@ module HTTPX
|
|
13
13
|
|
14
14
|
type multipart_nested_value = multipart_value | _ToAry[multipart_value] | _ToHash[string, multipart_value]
|
15
15
|
|
16
|
-
type multipart_input = Enumerable[[string, multipart_value], untyped]
|
17
|
-
|
18
16
|
class Encoder
|
19
17
|
include Transcoder::_Encoder
|
20
18
|
include _Reader
|
@@ -23,7 +21,7 @@ module HTTPX
|
|
23
21
|
|
24
22
|
private
|
25
23
|
|
26
|
-
def initialize: (_Each[Symbol | string, multipart_nested_value] multipart_data) -> untyped
|
24
|
+
def initialize: (_Each[[Symbol | string, multipart_nested_value]] multipart_data) -> untyped
|
27
25
|
|
28
26
|
def header_part: (string key, String content_type, String? filename) -> StringIO
|
29
27
|
|
@@ -37,7 +35,7 @@ module HTTPX
|
|
37
35
|
end
|
38
36
|
|
39
37
|
module MimeTypeDetector
|
40
|
-
def self?.call: (IO file, ?String filename) -> String?
|
38
|
+
def self?.call: (::IO file, ?String filename) -> String?
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
@@ -4,9 +4,8 @@ module HTTPX
|
|
4
4
|
|
5
5
|
interface _NTLMOptions
|
6
6
|
def ntlm: () -> NTLMParams?
|
7
|
-
def ntlm=: (NTLMParams) -> NTLMParams
|
8
7
|
end
|
9
|
-
|
8
|
+
|
10
9
|
def self.extra_options: (Options) -> (Options & _NTLMOptions)
|
11
10
|
|
12
11
|
def self.load_dependencies: (*untyped) -> void
|
@@ -22,6 +21,6 @@ module HTTPX
|
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
|
-
type sessionNTLMAuthentication =
|
24
|
+
type sessionNTLMAuthentication = sessionAuthentication & NTLMAuthentication::InstanceMethods
|
26
25
|
end
|
27
26
|
end
|
data/sig/plugins/persistent.rbs
CHANGED
@@ -2,15 +2,10 @@ module HTTPX
|
|
2
2
|
module Plugins
|
3
3
|
module Persistent
|
4
4
|
def self.load_dependencies: (singleton(Session)) -> void
|
5
|
-
|
6
|
-
|
7
|
-
def persistent: () -> bool?
|
8
|
-
def persistent=: (bool) -> bool
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.extra_options: (Options) -> (Options & _PersistentOptions)
|
5
|
+
|
6
|
+
def self.extra_options: (Options) -> (Options)
|
12
7
|
end
|
13
|
-
|
8
|
+
|
14
9
|
type sessionPersistent = sessionFollowRedirects
|
15
10
|
end
|
16
11
|
end
|
data/sig/plugins/proxy.rbs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module HTTPX
|
2
|
-
HTTPProxyError
|
2
|
+
class HTTPProxyError < Error
|
3
|
+
end
|
3
4
|
|
4
5
|
module Plugins
|
5
6
|
module Proxy
|
@@ -22,14 +23,13 @@ module HTTPX
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.configure: (singleton(Session)) -> void
|
25
|
-
|
26
|
-
type proxyParam = Parameters | Hash
|
27
|
-
|
26
|
+
|
27
|
+
type proxyParam = Parameters | Hash[Symbol, untyped]
|
28
|
+
|
28
29
|
interface _ProxyOptions
|
29
30
|
def proxy: () -> proxyParam?
|
30
|
-
def proxy=: (Parameters | _ToHash) -> proxyParam
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def self.extra_options: (Options) -> (Options & _ProxyOptions)
|
34
34
|
|
35
35
|
module InstanceMethods
|
@@ -41,6 +41,6 @@ module HTTPX
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
type sessionProxy = Session &
|
44
|
+
type sessionProxy = Session & Proxy::InstanceMethods
|
45
45
|
end
|
46
46
|
end
|
data/sig/plugins/proxy/ssh.rbs
CHANGED
@@ -3,16 +3,16 @@ module HTTPX
|
|
3
3
|
module Proxy
|
4
4
|
module SSH
|
5
5
|
def self.load_dependencies: (singleton(Session)) -> void
|
6
|
-
|
7
|
-
module
|
6
|
+
|
7
|
+
module InstanceMethods
|
8
8
|
private
|
9
9
|
|
10
|
-
def build_gateway_socket: (int, URI::
|
10
|
+
def build_gateway_socket: (int, URI::HTTP | URI::HTTPS, Options) -> _ToIO
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
|
16
|
-
type sessionSSHProxy =
|
16
|
+
type sessionSSHProxy = Proxy::InstanceMethods & Proxy::SSH::InstanceMethods
|
17
17
|
end
|
18
18
|
end
|
data/sig/plugins/retries.rbs
CHANGED
@@ -4,25 +4,21 @@ module HTTPX
|
|
4
4
|
MAX_RETRIES: Integer
|
5
5
|
IDEMPOTENT_METHODS: Array[verb]
|
6
6
|
RETRYABLE_ERRORS: Array[singleton(StandardError)]
|
7
|
-
|
7
|
+
|
8
8
|
interface _RetryCallback
|
9
9
|
def call: (response) -> bool?
|
10
10
|
end
|
11
11
|
|
12
12
|
interface _RetriesOptions
|
13
13
|
def retry_after: () -> Numeric?
|
14
|
-
def retry_after=: (Numeric) -> Numeric
|
15
14
|
|
16
15
|
def max_retries: () -> Integer?
|
17
|
-
def max_retries=: (int) -> Integer
|
18
16
|
|
19
|
-
def retry_change_requests: () ->
|
20
|
-
def retry_change_requests=: (bool) -> bool
|
17
|
+
def retry_change_requests: () -> boolish
|
21
18
|
|
22
19
|
def retry_on: () -> _RetryCallback?
|
23
|
-
def retry_on=: (_RetryCallback) -> _RetryCallback
|
24
20
|
end
|
25
|
-
|
21
|
+
|
26
22
|
def self.extra_options: (Options) -> (Options & _RetriesOptions)
|
27
23
|
|
28
24
|
module InstanceMethods
|
@@ -39,6 +35,6 @@ module HTTPX
|
|
39
35
|
end
|
40
36
|
end
|
41
37
|
|
42
|
-
type sessionRetries = Session &
|
38
|
+
type sessionRetries = Session & Retries::InstanceMethods
|
43
39
|
end
|
44
40
|
end
|