httpx 0.16.1 → 0.18.2
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 +4 -4
- data/README.md +4 -3
- data/doc/release_notes/0_17_0.md +49 -0
- data/doc/release_notes/0_18_0.md +69 -0
- data/doc/release_notes/0_18_1.md +12 -0
- data/doc/release_notes/0_18_2.md +10 -0
- data/lib/httpx/adapters/datadog.rb +1 -1
- data/lib/httpx/adapters/faraday.rb +5 -3
- data/lib/httpx/adapters/webmock.rb +9 -3
- data/lib/httpx/altsvc.rb +2 -2
- data/lib/httpx/chainable.rb +4 -4
- data/lib/httpx/connection/http1.rb +23 -14
- data/lib/httpx/connection/http2.rb +35 -17
- data/lib/httpx/connection.rb +74 -76
- data/lib/httpx/domain_name.rb +1 -1
- data/lib/httpx/extensions.rb +50 -4
- data/lib/httpx/headers.rb +1 -1
- data/lib/httpx/io/ssl.rb +5 -1
- data/lib/httpx/io/tls.rb +7 -7
- data/lib/httpx/loggable.rb +5 -5
- data/lib/httpx/options.rb +35 -13
- data/lib/httpx/parser/http1.rb +10 -6
- data/lib/httpx/plugins/aws_sdk_authentication.rb +42 -18
- data/lib/httpx/plugins/aws_sigv4.rb +9 -11
- data/lib/httpx/plugins/compression.rb +5 -3
- data/lib/httpx/plugins/cookies/jar.rb +1 -1
- data/lib/httpx/plugins/digest_authentication.rb +4 -4
- data/lib/httpx/plugins/expect.rb +7 -3
- data/lib/httpx/plugins/grpc/message.rb +2 -2
- data/lib/httpx/plugins/grpc.rb +3 -3
- data/lib/httpx/plugins/h2c.rb +7 -3
- data/lib/httpx/plugins/internal_telemetry.rb +8 -8
- data/lib/httpx/plugins/multipart/decoder.rb +187 -0
- data/lib/httpx/plugins/multipart/mime_type_detector.rb +3 -3
- data/lib/httpx/plugins/multipart/part.rb +2 -2
- data/lib/httpx/plugins/multipart.rb +16 -2
- data/lib/httpx/plugins/ntlm_authentication.rb +4 -4
- data/lib/httpx/plugins/proxy/ssh.rb +11 -4
- data/lib/httpx/plugins/proxy.rb +6 -4
- data/lib/httpx/plugins/response_cache/store.rb +55 -0
- data/lib/httpx/plugins/response_cache.rb +88 -0
- data/lib/httpx/plugins/retries.rb +36 -14
- data/lib/httpx/plugins/stream.rb +3 -4
- data/lib/httpx/pool.rb +39 -13
- data/lib/httpx/registry.rb +1 -1
- data/lib/httpx/request.rb +12 -13
- data/lib/httpx/resolver/https.rb +5 -7
- data/lib/httpx/resolver/native.rb +4 -2
- data/lib/httpx/resolver/resolver_mixin.rb +2 -1
- data/lib/httpx/resolver/system.rb +2 -0
- data/lib/httpx/resolver.rb +2 -2
- data/lib/httpx/response.rb +60 -44
- data/lib/httpx/selector.rb +16 -19
- data/lib/httpx/session.rb +22 -15
- data/lib/httpx/session2.rb +1 -1
- data/lib/httpx/timers.rb +84 -0
- data/lib/httpx/transcoder/body.rb +2 -1
- data/lib/httpx/transcoder/form.rb +20 -0
- data/lib/httpx/transcoder/json.rb +12 -0
- data/lib/httpx/transcoder.rb +62 -1
- data/lib/httpx/utils.rb +10 -2
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +1 -0
- data/sig/buffer.rbs +2 -2
- data/sig/chainable.rbs +7 -1
- data/sig/connection/http1.rbs +15 -4
- data/sig/connection/http2.rbs +19 -5
- data/sig/connection.rbs +15 -9
- data/sig/headers.rbs +19 -18
- data/sig/options.rbs +13 -5
- data/sig/parser/http1.rbs +3 -3
- data/sig/plugins/aws_sdk_authentication.rbs +22 -4
- data/sig/plugins/aws_sigv4.rbs +12 -3
- data/sig/plugins/basic_authentication.rbs +1 -1
- data/sig/plugins/multipart.rbs +64 -8
- data/sig/plugins/proxy.rbs +6 -6
- data/sig/plugins/response_cache.rbs +35 -0
- data/sig/plugins/retries.rbs +3 -0
- data/sig/pool.rbs +6 -0
- data/sig/request.rbs +11 -8
- data/sig/resolver/native.rbs +2 -1
- data/sig/resolver/resolver_mixin.rbs +1 -1
- data/sig/resolver/system.rbs +3 -1
- data/sig/response.rbs +11 -4
- data/sig/selector.rbs +8 -6
- data/sig/session.rbs +8 -14
- data/sig/timers.rbs +32 -0
- data/sig/transcoder/form.rbs +1 -0
- data/sig/transcoder/json.rbs +1 -0
- data/sig/transcoder.rbs +5 -4
- data/sig/utils.rbs +4 -0
- metadata +18 -17
data/sig/chainable.rbs
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Chainable
|
3
|
-
def request: (*
|
3
|
+
def request: (*Request, **untyped) -> Array[response]
|
4
|
+
| (Request, **untyped) -> response
|
5
|
+
| (verb | string, uri | [uri], **untyped) -> response
|
6
|
+
| (Array[[verb | string, uri] | [verb | string, uri, options]], **untyped) -> Array[response]
|
7
|
+
| (verb | string, _Each[uri | [uri, options]], **untyped) -> Array[response]
|
8
|
+
|
4
9
|
def accept: (String) -> Session
|
5
10
|
def wrap: () { (Session) -> void } -> void
|
6
11
|
|
@@ -27,6 +32,7 @@ module HTTPX
|
|
27
32
|
| (:stream, ?options) -> Plugins::sessionStream
|
28
33
|
| (:aws_sigv4, ?options) -> Plugins::awsSigV4Session
|
29
34
|
| (:grpc, ?options) -> Plugins::grpcSession
|
35
|
+
| (:response_cache, ?options) -> Plugins::sessionResponseCache
|
30
36
|
| (Symbol | Module, ?options) { (Class) -> void } -> Session
|
31
37
|
| (Symbol | Module, ?options) -> Session
|
32
38
|
|
data/sig/connection/http1.rbs
CHANGED
@@ -3,6 +3,10 @@ module HTTPX
|
|
3
3
|
include Callbacks
|
4
4
|
include Loggable
|
5
5
|
|
6
|
+
UPCASED: Hash[String, String]
|
7
|
+
MAX_REQUESTS: Integer
|
8
|
+
CRLF: String
|
9
|
+
|
6
10
|
attr_reader pending: Array[Request]
|
7
11
|
attr_reader requests: Array[Request]
|
8
12
|
|
@@ -11,6 +15,11 @@ module HTTPX
|
|
11
15
|
@max_requests: Integer
|
12
16
|
@parser: Parser::HTTP1
|
13
17
|
@buffer: Buffer
|
18
|
+
@version: [Integer, Integer]
|
19
|
+
@handshake_completed: bool
|
20
|
+
@pipelining: bool
|
21
|
+
|
22
|
+
@request: Request?
|
14
23
|
|
15
24
|
def interests: () -> io_interests?
|
16
25
|
|
@@ -30,11 +39,13 @@ module HTTPX
|
|
30
39
|
|
31
40
|
def handle_error: (StandardError ex) -> void
|
32
41
|
|
42
|
+
def on_start: () -> void
|
43
|
+
|
33
44
|
def on_headers: (Hash[String, Array[String]] headers) -> void
|
34
45
|
|
35
46
|
def on_trailers: (Hash[String, Array[String]] headers) -> void
|
36
47
|
|
37
|
-
def on_data: (
|
48
|
+
def on_data: (String chunk) -> void
|
38
49
|
|
39
50
|
def on_complete: () -> void
|
40
51
|
|
@@ -42,7 +53,7 @@ module HTTPX
|
|
42
53
|
|
43
54
|
def ping: () -> void
|
44
55
|
|
45
|
-
def timeout: () ->
|
56
|
+
def timeout: () -> Numeric
|
46
57
|
|
47
58
|
private
|
48
59
|
|
@@ -54,7 +65,7 @@ module HTTPX
|
|
54
65
|
|
55
66
|
def disable_pipelining: () -> void
|
56
67
|
|
57
|
-
def set_protocol_headers: (Request) -> _Each[[
|
68
|
+
def set_protocol_headers: (Request) -> _Each[[String, String]]
|
58
69
|
|
59
70
|
def headline_uri: (Request) -> String
|
60
71
|
|
@@ -64,7 +75,7 @@ module HTTPX
|
|
64
75
|
|
65
76
|
def join_trailers: (Request request) -> void
|
66
77
|
|
67
|
-
def join_headers2: (_Each[[
|
78
|
+
def join_headers2: (_Each[[String, String]] headers) -> void
|
68
79
|
|
69
80
|
def join_body: (Request request) -> void
|
70
81
|
|
data/sig/connection/http2.rbs
CHANGED
@@ -3,10 +3,13 @@ module HTTPX
|
|
3
3
|
include Callbacks
|
4
4
|
include Loggable
|
5
5
|
|
6
|
+
MAX_CONCURRENT_REQUESTS: Integer
|
7
|
+
|
6
8
|
attr_reader streams: Hash[Request, HTTP2Next::Stream]
|
7
9
|
attr_reader pending: Array[Request]
|
8
10
|
|
9
11
|
@options: Options
|
12
|
+
@settings: Hash[Symbol, Integer | bool]
|
10
13
|
@max_concurrent_requests: Integer
|
11
14
|
@max_requests: Integer
|
12
15
|
@drains: Hash[Request, String]
|
@@ -23,7 +26,7 @@ module HTTPX
|
|
23
26
|
|
24
27
|
def <<: (String) -> void
|
25
28
|
|
26
|
-
def can_buffer_more_requests
|
29
|
+
def can_buffer_more_requests?: () -> bool
|
27
30
|
|
28
31
|
def send: (Request) -> void
|
29
32
|
|
@@ -35,7 +38,7 @@ module HTTPX
|
|
35
38
|
|
36
39
|
alias reset init_connection
|
37
40
|
|
38
|
-
def timeout: () ->
|
41
|
+
def timeout: () -> Numeric
|
39
42
|
|
40
43
|
private
|
41
44
|
|
@@ -45,7 +48,7 @@ module HTTPX
|
|
45
48
|
|
46
49
|
def headline_uri: (Request) -> String
|
47
50
|
|
48
|
-
def set_protocol_headers: (Request) -> _Each[[
|
51
|
+
def set_protocol_headers: (Request) -> _Each[[String, String]]
|
49
52
|
|
50
53
|
def handle: (Request request, HTTP2Next::Stream stream) -> void
|
51
54
|
|
@@ -61,9 +64,11 @@ module HTTPX
|
|
61
64
|
|
62
65
|
def on_stream_headers: (HTTP2Next::Stream stream, Request request, Array[[String, String]] headers) -> void
|
63
66
|
|
64
|
-
def on_stream_trailers: (HTTP2Next::Stream stream,
|
67
|
+
def on_stream_trailers: (HTTP2Next::Stream stream, Response response, Array[[String, String]] headers) -> void
|
68
|
+
|
69
|
+
def on_stream_data: (HTTP2Next::Stream stream, Request request, String data) -> void
|
65
70
|
|
66
|
-
def
|
71
|
+
def on_stream_refuse: (HTTP2Next::Stream stream, Request request, StandardError error) -> void
|
67
72
|
|
68
73
|
def on_stream_close: (HTTP2Next::Stream stream, Request request, (Symbol | StandardError)? error) -> void
|
69
74
|
|
@@ -74,12 +79,21 @@ module HTTPX
|
|
74
79
|
def on_close: (Integer last_frame, Symbol? error, String? payload) -> void
|
75
80
|
|
76
81
|
def on_frame_sent: (HTTP2Next::frame) -> void
|
82
|
+
|
77
83
|
def on_frame_received: (HTTP2Next::frame) -> void
|
78
84
|
|
85
|
+
def on_altsvc: (String origin, HTTP2Next::frame) -> void
|
86
|
+
|
79
87
|
def on_promise: (HTTP2Next::Stream) -> void
|
80
88
|
|
81
89
|
def on_origin: (String) -> void
|
82
90
|
|
83
91
|
def on_pong: (string ping) -> void
|
92
|
+
|
93
|
+
class Error < ::HTTPX::Error
|
94
|
+
end
|
95
|
+
|
96
|
+
class GoawayError < Error
|
97
|
+
end
|
84
98
|
end
|
85
99
|
end
|
data/sig/connection.rbs
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module HTTPX
|
2
2
|
class Connection
|
3
|
-
|
4
3
|
interface _Parser
|
5
4
|
|
6
5
|
def on: (Symbol) { (*untyped) -> void } -> void
|
@@ -26,6 +25,15 @@ module HTTPX
|
|
26
25
|
attr_reader state: Symbol
|
27
26
|
attr_reader pending: Array[Request]
|
28
27
|
attr_reader options: Options
|
28
|
+
attr_writer timers: Timers
|
29
|
+
|
30
|
+
@origins: Array[URI::Generic]
|
31
|
+
@window_size: Integer
|
32
|
+
@read_buffer: Buffer
|
33
|
+
@write_buffer: Buffer
|
34
|
+
@inflight: Integer
|
35
|
+
@keep_alive_timeout: Numeric?
|
36
|
+
@total_timeout: Numeric?
|
29
37
|
|
30
38
|
def addresses: () -> Array[ipaddr]?
|
31
39
|
|
@@ -37,8 +45,7 @@ module HTTPX
|
|
37
45
|
|
38
46
|
def coalescable?: (Connection) -> bool
|
39
47
|
|
40
|
-
def create_idle: (options) -> Connection
|
41
|
-
| () -> Connection
|
48
|
+
def create_idle: (?Hash[Symbol, untyped] options) -> Connection
|
42
49
|
|
43
50
|
def merge: (Connection) -> void
|
44
51
|
|
@@ -47,11 +54,12 @@ module HTTPX
|
|
47
54
|
def match_altsvcs?: (URI::Generic uri) -> bool
|
48
55
|
|
49
56
|
def connecting?: () -> bool
|
57
|
+
|
50
58
|
def inflight?: () -> boolish
|
51
59
|
|
52
60
|
def interests: () -> io_interests?
|
53
61
|
|
54
|
-
def to_io: () ->
|
62
|
+
def to_io: () -> IO
|
55
63
|
|
56
64
|
def call: () -> void
|
57
65
|
|
@@ -62,6 +70,7 @@ module HTTPX
|
|
62
70
|
|
63
71
|
def timeout: () -> Numeric?
|
64
72
|
|
73
|
+
def deactivate: () -> void
|
65
74
|
private
|
66
75
|
|
67
76
|
def initialize: (String, URI::Generic, options) -> untyped
|
@@ -76,6 +85,8 @@ module HTTPX
|
|
76
85
|
|
77
86
|
def parser: () -> _Parser
|
78
87
|
|
88
|
+
def send_request_to_parser: (Request request) -> void
|
89
|
+
|
79
90
|
def build_parser: () -> _Parser
|
80
91
|
| (String) -> _Parser
|
81
92
|
|
@@ -83,15 +94,10 @@ module HTTPX
|
|
83
94
|
|
84
95
|
def transition: (Symbol) -> void
|
85
96
|
|
86
|
-
def handle_response: () -> void
|
87
|
-
|
88
97
|
def on_error: (HTTPX::TimeoutError | Error | StandardError) -> void
|
89
98
|
|
90
99
|
def handle_error: (StandardError) -> void
|
91
100
|
|
92
|
-
def total_timeout: () -> untyped?
|
93
|
-
# def total_timeout: () -> Timers::Timer?
|
94
|
-
#
|
95
101
|
def purge_after_closed: () -> void
|
96
102
|
end
|
97
103
|
end
|
data/sig/headers.rbs
CHANGED
@@ -2,44 +2,45 @@ module HTTPX
|
|
2
2
|
class Headers
|
3
3
|
include _ToS
|
4
4
|
|
5
|
-
|
5
|
+
EMPTY: Array[untyped]
|
6
6
|
|
7
|
-
|
7
|
+
@headers: Hash[String, Array[String]]
|
8
|
+
|
9
|
+
def self.new: (?untyped headers) -> instance
|
8
10
|
|
9
11
|
def ==: (untyped other) -> bool
|
10
12
|
|
11
|
-
def []: (
|
12
|
-
def []=: (
|
13
|
+
def []: (String field) -> String?
|
14
|
+
def []=: (String field, headers_value value) -> void
|
13
15
|
|
14
|
-
def add: (
|
15
|
-
def delete: (
|
16
|
+
def add: (String field, string value) -> void
|
17
|
+
def delete: (String field) -> Array[String]?
|
16
18
|
|
17
|
-
def each: (?_Each[[
|
18
|
-
| (?_Each[[
|
19
|
+
def each: (?_Each[[String, String]]? extra_headers) { (String k, String v) -> void } -> void
|
20
|
+
| (?_Each[[String, String]]? extra_headers) -> Enumerable[[String, String]]
|
19
21
|
|
20
|
-
def get: (
|
21
|
-
def key?: (
|
22
|
+
def get: (String field) -> Array[String]
|
23
|
+
def key?: (String downcased_key) -> bool
|
22
24
|
|
23
|
-
def merge: (_Each[[
|
25
|
+
def merge: (_Each[[String, headers_value]] other) -> Headers
|
24
26
|
|
25
27
|
def same_headers?: (untyped headers) -> bool
|
26
28
|
|
27
|
-
def to_a: () -> Array[[
|
28
|
-
def to_hash: () -> Hash[
|
29
|
+
def to_a: () -> Array[[String, String]]
|
30
|
+
def to_hash: () -> Hash[String, String]
|
29
31
|
alias to_h to_hash
|
30
32
|
|
31
33
|
def inspect: () -> String
|
32
34
|
|
33
35
|
private
|
34
36
|
|
35
|
-
def initialize: (headers?) -> untyped
|
37
|
+
def initialize: (?headers?) -> untyped
|
36
38
|
def array_value: (headers_value) -> Array[String]
|
37
|
-
def downcased: (
|
39
|
+
def downcased: (_ToS field) -> String
|
38
40
|
end
|
39
41
|
|
40
|
-
type headers_key = String | Symbol
|
41
42
|
type headers_value = _ToS | Array[_ToS]
|
42
|
-
type headers_hash = Hash[
|
43
|
-
type headers_input = headers_hash | Array[[
|
43
|
+
type headers_hash = Hash[_ToS, headers_value]
|
44
|
+
type headers_input = headers_hash | Array[[_ToS, string]]
|
44
45
|
type headers = Headers | headers_input
|
45
46
|
end
|
data/sig/options.rbs
CHANGED
@@ -11,7 +11,7 @@ module HTTPX
|
|
11
11
|
DEFAULT_OPTIONS: Hash[Symbol, untyped]
|
12
12
|
|
13
13
|
type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :total_timeout
|
14
|
-
type timeout = Hash[timeout_type, Numeric
|
14
|
+
type timeout = Hash[timeout_type, Numeric]
|
15
15
|
|
16
16
|
def self.new: (?options) -> instance
|
17
17
|
|
@@ -26,6 +26,9 @@ module HTTPX
|
|
26
26
|
# timeout
|
27
27
|
attr_reader timeout: timeout
|
28
28
|
|
29
|
+
# http2_settings
|
30
|
+
attr_reader http2_settings: Hash[Symbol, Integer | bool]
|
31
|
+
|
29
32
|
# max_concurrent_requests
|
30
33
|
attr_reader max_concurrent_requests: Integer?
|
31
34
|
|
@@ -45,7 +48,7 @@ module HTTPX
|
|
45
48
|
attr_reader transport_options: Hash[untyped, untyped]?
|
46
49
|
|
47
50
|
# addresses
|
48
|
-
attr_reader addresses:
|
51
|
+
attr_reader addresses: Array[ipaddr]?
|
49
52
|
|
50
53
|
# params
|
51
54
|
attr_reader params: Transcoder::urlencoded_input?
|
@@ -59,6 +62,9 @@ module HTTPX
|
|
59
62
|
# body
|
60
63
|
attr_reader body: bodyIO?
|
61
64
|
|
65
|
+
# body
|
66
|
+
attr_reader origin: URI::Generic?
|
67
|
+
|
62
68
|
# ssl
|
63
69
|
|
64
70
|
# http2_settings
|
@@ -103,13 +109,15 @@ module HTTPX
|
|
103
109
|
attr_reader resolver_options: Hash[Symbol, untyped]?
|
104
110
|
|
105
111
|
def ==: (untyped other) -> bool
|
106
|
-
def merge: (_ToHash[Symbol
|
112
|
+
def merge: (_ToHash[Symbol, untyped] other) -> instance
|
107
113
|
def to_hash: () -> Hash[Symbol, untyped]
|
108
114
|
|
109
115
|
private
|
110
116
|
|
111
|
-
|
117
|
+
REQUEST_IVARS: Array[Symbol]
|
118
|
+
|
119
|
+
def initialize: (?options options) -> untyped
|
112
120
|
end
|
113
121
|
|
114
|
-
type options = Options | Hash[Symbol
|
122
|
+
type options = Options | Hash[Symbol, untyped]
|
115
123
|
end
|
data/sig/parser/http1.rbs
CHANGED
@@ -5,9 +5,9 @@ module HTTPX
|
|
5
5
|
interface _HTTP1Events
|
6
6
|
|
7
7
|
def on_start: () -> void
|
8
|
-
def on_headers: (parsed_headers) -> void
|
9
|
-
def on_trailers: (parsed_headers) -> void
|
10
|
-
def on_data: (String) -> void
|
8
|
+
def on_headers: (parsed_headers headers) -> void
|
9
|
+
def on_trailers: (parsed_headers trailers) -> void
|
10
|
+
def on_data: (String data) -> void
|
11
11
|
def on_complete: () -> void
|
12
12
|
end
|
13
13
|
|
@@ -1,25 +1,43 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module AwsSdkAuthentication
|
4
|
+
class Configuration
|
5
|
+
attr_reader profile: String?
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def initialize: (String? profile) -> void
|
10
|
+
end
|
11
|
+
|
4
12
|
class Credentials
|
13
|
+
@aws_credentials: untyped
|
14
|
+
|
5
15
|
include _SigV4Credentials
|
6
16
|
|
7
17
|
private
|
8
|
-
|
18
|
+
|
9
19
|
def initialize: (untyped aws_credentials) -> untyped
|
10
20
|
end
|
11
21
|
|
22
|
+
interface _AwsSdkOptions
|
23
|
+
def aws_profile: () -> String?
|
24
|
+
end
|
25
|
+
|
12
26
|
def self.load_dependencies: (singleton(Session)) -> void
|
13
27
|
|
14
28
|
def self.configure: (singleton(Session)) -> void
|
15
29
|
|
16
|
-
def self.extra_options: (Options) -> (Options)
|
30
|
+
def self.extra_options: (Options) -> (Options & _AwsSdkOptions)
|
31
|
+
|
32
|
+
def self.credentials: (String? profile) -> Credentials
|
33
|
+
|
34
|
+
def self.region: (String? profile) -> String
|
17
35
|
|
18
36
|
module InstanceMethods
|
19
|
-
def aws_sdk_authentication: (**untyped) -> instance
|
37
|
+
def aws_sdk_authentication: (?credentials: Credentials, ?region: String, **untyped) -> instance
|
20
38
|
end
|
21
39
|
end
|
22
40
|
|
23
|
-
type sessionAwsSdkAuthentication =
|
41
|
+
type sessionAwsSdkAuthentication = awsSigV4Session & AwsSdkAuthentication::InstanceMethods
|
24
42
|
end
|
25
43
|
end
|
data/sig/plugins/aws_sigv4.rbs
CHANGED
@@ -9,13 +9,21 @@ module HTTPX
|
|
9
9
|
|
10
10
|
module AWSSigV4
|
11
11
|
|
12
|
-
Credentials
|
12
|
+
class Credentials < Struct[[String, String, String?]]
|
13
|
+
attr_reader username: String
|
14
|
+
attr_reader password: String
|
15
|
+
attr_reader security_token: String?
|
16
|
+
end
|
13
17
|
|
14
18
|
|
15
19
|
class Signer
|
16
20
|
|
17
|
-
|
21
|
+
@unsigned_headers: Set[String]
|
22
|
+
|
23
|
+
def sign!: (Request & RequestMethods request) -> void
|
18
24
|
|
25
|
+
def self.new: (instance) -> instance
|
26
|
+
| (**untyped params) -> instance
|
19
27
|
private
|
20
28
|
|
21
29
|
def initialize: (
|
@@ -33,9 +41,10 @@ module HTTPX
|
|
33
41
|
) -> untyped
|
34
42
|
|
35
43
|
|
36
|
-
def
|
44
|
+
def hexdigest: (bodyIO value) -> String
|
37
45
|
|
38
46
|
def hmac: (String key, String value) -> String
|
47
|
+
|
39
48
|
def hexhmac: (String key, String value) -> String
|
40
49
|
end
|
41
50
|
|
@@ -10,6 +10,6 @@ module HTTPX
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
type sessionBasicAuthentication = sessionAuthentication & BasicAuthentication::InstanceMethods
|
13
|
+
type sessionBasicAuthentication = sessionAuthentication & Authentication::InstanceMethods & BasicAuthentication::InstanceMethods
|
14
14
|
end
|
15
15
|
end
|
data/sig/plugins/multipart.rbs
CHANGED
@@ -1,41 +1,97 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Plugins
|
3
3
|
module Multipart
|
4
|
+
interface _MultipartInput
|
5
|
+
def filename: () -> String
|
6
|
+
def content_type: () -> String
|
7
|
+
def read: (?int? length, ?string? output) -> String?
|
8
|
+
end
|
9
|
+
|
10
|
+
MULTIPART_VALUE_COND: ^(_Reader | record_multipart_value value) -> bool
|
11
|
+
|
4
12
|
def self.load_dependencies: (singleton(Session)) -> void
|
5
13
|
def self.configure: (*untyped) -> void
|
6
14
|
def self?.encode: (untyped) -> (Encoder | Transcoder::Form::Encoder)
|
15
|
+
def self?.decode: (HTTPX::Response response) -> Transcoder::_Decoder
|
16
|
+
|
17
|
+
def self?.normalize_keys: [U] (_ToS key, _ToAry[untyped] | _ToHash[_ToS, untyped] | untyped value) { (String, ?untyped) -> U } -> U
|
7
18
|
|
8
19
|
type multipart_value = string | Pathname | File | _Reader
|
9
20
|
|
10
|
-
type record_multipart_value = multipart_value |
|
11
|
-
{ content_type: String, filename: String, body: multipart_value } |
|
21
|
+
type record_multipart_value = { content_type: String, filename: String, body: multipart_value } |
|
12
22
|
{ content_type: String, body: multipart_value }
|
13
23
|
|
14
24
|
type multipart_nested_value = multipart_value | _ToAry[multipart_value] | _ToHash[string, multipart_value]
|
15
25
|
|
16
26
|
class Encoder
|
17
27
|
include Transcoder::_Encoder
|
18
|
-
|
28
|
+
|
29
|
+
@boundary: String
|
30
|
+
@part_index: Integer
|
31
|
+
@buffer: String
|
32
|
+
|
33
|
+
@form: Enumerable[[Symbol | string, multipart_nested_value]]
|
34
|
+
@parts: Array[_Reader]
|
19
35
|
|
20
36
|
def content_type: () -> String
|
21
37
|
|
38
|
+
def read: (?int? length, ?string? buffer) -> String?
|
39
|
+
|
40
|
+
def rewind: () -> void
|
41
|
+
|
22
42
|
private
|
23
43
|
|
24
|
-
def
|
44
|
+
def to_parts: (Enumerable[[Symbol | string, multipart_nested_value]] multipart_data) -> Array[_Reader]
|
45
|
+
|
46
|
+
def initialize: (Enumerable[[Symbol | string, multipart_nested_value]] multipart_data) -> untyped
|
25
47
|
|
26
48
|
def header_part: (string key, String content_type, String? filename) -> StringIO
|
27
49
|
|
28
|
-
def read_chunks: (String buffer, Integer? length) -> void
|
50
|
+
def read_chunks: (String buffer, ?Integer? length) -> void
|
29
51
|
|
30
|
-
def read_from_part: (Integer? max_length) ->
|
52
|
+
def read_from_part: (?Integer? max_length) -> String?
|
53
|
+
end
|
54
|
+
|
55
|
+
class Decoder
|
56
|
+
BOUNDARY_RE: Regexp
|
57
|
+
|
58
|
+
@state: :idle | :part_header | :part_body | :parse_boundary | :done
|
59
|
+
@buffer: String
|
60
|
+
@parts: Hash[String, untyped]
|
61
|
+
@boundary: String
|
62
|
+
@intermediate_boundary: String
|
63
|
+
|
64
|
+
def call: (Response response, untyped) -> Hash[String, untyped]
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def initialize: (Response response) -> void
|
69
|
+
|
70
|
+
def parse: () -> void
|
71
|
+
|
72
|
+
def get_filename: (String head) -> String?
|
73
|
+
end
|
74
|
+
|
75
|
+
class FilePart # < SimpleDelegator
|
76
|
+
attr_reader original_filename: String
|
77
|
+
attr_reader content_type: String
|
78
|
+
|
79
|
+
# @file: Tempfile
|
80
|
+
|
81
|
+
# private
|
82
|
+
|
83
|
+
def initialize: (String filename, String content_type) -> void
|
31
84
|
end
|
32
85
|
|
33
86
|
module Part
|
34
|
-
def self?.call: (
|
87
|
+
def self?.call: [U] (_MultipartInput multipart_input) -> [U, String, String]
|
88
|
+
| (multipart_nested_value input) -> ([StringIO, String, String?] | [File, String, String])
|
35
89
|
end
|
36
90
|
|
37
91
|
module MimeTypeDetector
|
38
|
-
|
92
|
+
DEFAULT_MIMETYPE: String
|
93
|
+
|
94
|
+
def self?.call: (::IO file, String filename) -> String?
|
39
95
|
end
|
40
96
|
end
|
41
97
|
end
|
data/sig/plugins/proxy.rbs
CHANGED
@@ -9,8 +9,8 @@ module HTTPX
|
|
9
9
|
|
10
10
|
class Parameters
|
11
11
|
attr_reader uri: URI::Generic
|
12
|
-
attr_reader username:
|
13
|
-
attr_reader password:
|
12
|
+
attr_reader username: String?
|
13
|
+
attr_reader password: String?
|
14
14
|
|
15
15
|
def authenticated?: () -> boolish
|
16
16
|
def token_authentication: () -> String?
|
@@ -19,7 +19,7 @@ module HTTPX
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def initialize: (uri: generic_uri, ?username:
|
22
|
+
def initialize: (uri: generic_uri, ?username: String, ?password: String) -> untyped
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.configure: (singleton(Session)) -> void
|
@@ -35,9 +35,9 @@ module HTTPX
|
|
35
35
|
module InstanceMethods
|
36
36
|
private
|
37
37
|
|
38
|
-
def proxy_uris: (
|
39
|
-
| (
|
40
|
-
| (
|
38
|
+
def proxy_uris: (generic_uri, Options & _ProxyOptions) -> { uri: generic_uri, username: String, password: String }
|
39
|
+
| (generic_uri, Options & _ProxyOptions) -> { uri: generic_uri }
|
40
|
+
| (generic_uri, Options & _ProxyOptions) -> nil
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module ResponseCache
|
4
|
+
CACHEABLE_VERBS: Array[Symbol]
|
5
|
+
|
6
|
+
def self?.cacheable_request?: (Request request) -> bool
|
7
|
+
def self?.cacheable_response?: (response response) -> bool
|
8
|
+
def self?.cached_response?: (response response) -> bool
|
9
|
+
|
10
|
+
class Store
|
11
|
+
@store: Hash[URI::Generic, Response]
|
12
|
+
|
13
|
+
def lookup: (URI::Generic uri) -> Response?
|
14
|
+
|
15
|
+
def cached?: (URI::Generic uri) -> bool
|
16
|
+
|
17
|
+
def cache: (URI::Generic uri, Response response) -> void
|
18
|
+
|
19
|
+
def prepare: (Request request) -> void
|
20
|
+
end
|
21
|
+
|
22
|
+
module InstanceMethods
|
23
|
+
@response_cache: Store
|
24
|
+
|
25
|
+
def clear_response_cache: () -> void
|
26
|
+
end
|
27
|
+
|
28
|
+
module ResponseMethods
|
29
|
+
def copy_from_cached: (Response other) -> void
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
type sessionResponseCache = Session & ResponseCache::InstanceMethods
|
34
|
+
end
|
35
|
+
end
|
data/sig/plugins/retries.rbs
CHANGED
@@ -4,6 +4,7 @@ module HTTPX
|
|
4
4
|
MAX_RETRIES: Integer
|
5
5
|
IDEMPOTENT_METHODS: Array[verb]
|
6
6
|
RETRYABLE_ERRORS: Array[singleton(StandardError)]
|
7
|
+
DEFAULT_JITTER: ^(Numeric) -> Numeric
|
7
8
|
|
8
9
|
interface _RetryCallback
|
9
10
|
def call: (response) -> bool?
|
@@ -12,6 +13,8 @@ module HTTPX
|
|
12
13
|
interface _RetriesOptions
|
13
14
|
def retry_after: () -> Numeric?
|
14
15
|
|
16
|
+
def retry_jitter: () -> ^(Numeric) -> Numeric
|
17
|
+
|
15
18
|
def max_retries: () -> Integer?
|
16
19
|
|
17
20
|
def retry_change_requests: () -> boolish
|
data/sig/pool.rbs
CHANGED
@@ -10,6 +10,8 @@ module HTTPX
|
|
10
10
|
|
11
11
|
def find_connection: (generic_uri, Options) -> Connection?
|
12
12
|
|
13
|
+
def deactivate: (*Array[Connection]) -> void
|
14
|
+
|
13
15
|
private
|
14
16
|
|
15
17
|
def initialize: () -> untyped
|
@@ -26,6 +28,10 @@ module HTTPX
|
|
26
28
|
|
27
29
|
def unregister_connection: (Connection) -> void
|
28
30
|
|
31
|
+
def select_connection: (resolver | Connection connection) -> void
|
32
|
+
|
33
|
+
def deselect_connection: (resolver | Connection connection) -> void
|
34
|
+
|
29
35
|
def coalesce_connections: (Connection, Connection) -> void
|
30
36
|
|
31
37
|
def next_timeout: () -> Numeric?
|