httpx 0.15.3 → 0.17.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.
- checksums.yaml +4 -4
- data/doc/release_notes/0_15_4.md +5 -0
- data/doc/release_notes/0_16_0.md +93 -0
- data/doc/release_notes/0_16_1.md +5 -0
- data/doc/release_notes/0_17_0.md +49 -0
- data/lib/httpx/adapters/faraday.rb +3 -11
- data/lib/httpx/adapters/webmock.rb +2 -2
- 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/http1.rb +18 -10
- data/lib/httpx/connection/http2.rb +14 -21
- data/lib/httpx/connection.rb +6 -7
- data/lib/httpx/errors.rb +11 -11
- data/lib/httpx/headers.rb +1 -1
- data/lib/httpx/io/ssl.rb +2 -2
- data/lib/httpx/io/tls.rb +1 -1
- data/lib/httpx/options.rb +108 -81
- data/lib/httpx/parser/http1.rb +11 -7
- data/lib/httpx/plugins/aws_sigv4.rb +10 -9
- data/lib/httpx/plugins/compression.rb +12 -11
- data/lib/httpx/plugins/cookies/cookie.rb +4 -2
- data/lib/httpx/plugins/cookies/jar.rb +20 -1
- data/lib/httpx/plugins/cookies.rb +20 -7
- data/lib/httpx/plugins/digest_authentication.rb +19 -15
- data/lib/httpx/plugins/expect.rb +19 -15
- data/lib/httpx/plugins/follow_redirects.rb +9 -9
- data/lib/httpx/plugins/grpc/call.rb +4 -1
- data/lib/httpx/plugins/grpc.rb +73 -47
- data/lib/httpx/plugins/h2c.rb +7 -3
- 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 +14 -0
- data/lib/httpx/plugins/ntlm_authentication.rb +12 -10
- 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 +20 -13
- data/lib/httpx/plugins/proxy.rb +10 -10
- data/lib/httpx/plugins/retries.rb +25 -21
- data/lib/httpx/plugins/stream.rb +2 -3
- data/lib/httpx/plugins/upgrade.rb +7 -6
- data/lib/httpx/registry.rb +2 -2
- data/lib/httpx/request.rb +10 -19
- data/lib/httpx/resolver/https.rb +0 -2
- data/lib/httpx/resolver/native.rb +15 -3
- data/lib/httpx/resolver/resolver_mixin.rb +2 -1
- data/lib/httpx/response.rb +72 -38
- data/lib/httpx/selector.rb +6 -7
- data/lib/httpx/session.rb +34 -21
- data/lib/httpx/session2.rb +23 -0
- data/lib/httpx/transcoder/body.rb +1 -1
- data/lib/httpx/transcoder/chunker.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 +2 -2
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +6 -3
- data/sig/buffer.rbs +3 -1
- data/sig/chainable.rbs +30 -29
- data/sig/connection/http1.rbs +11 -5
- data/sig/connection/http2.rbs +16 -5
- data/sig/connection.rbs +23 -11
- data/sig/errors.rbs +35 -1
- data/sig/headers.rbs +20 -19
- data/sig/httpx.rbs +4 -1
- data/sig/loggable.rbs +3 -1
- data/sig/options.rbs +45 -34
- data/sig/parser/http1.rbs +3 -3
- data/sig/plugins/authentication.rbs +1 -1
- data/sig/plugins/aws_sdk_authentication.rbs +5 -1
- data/sig/plugins/aws_sigv4.rbs +13 -5
- data/sig/plugins/basic_authentication.rbs +1 -1
- data/sig/plugins/compression.rbs +4 -6
- data/sig/plugins/cookies/cookie.rbs +5 -7
- data/sig/plugins/cookies/jar.rbs +9 -10
- data/sig/plugins/cookies.rbs +4 -5
- 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 +64 -10
- data/sig/plugins/ntlm_authentication.rbs +2 -3
- data/sig/plugins/persistent.rbs +3 -8
- data/sig/plugins/proxy/ssh.rbs +4 -4
- data/sig/plugins/proxy.rbs +13 -13
- 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 +11 -8
- data/sig/resolver/native.rbs +12 -6
- data/sig/resolver/resolver_mixin.rbs +4 -5
- data/sig/resolver/system.rbs +2 -0
- data/sig/resolver.rbs +7 -0
- data/sig/response.rbs +24 -12
- data/sig/selector.rbs +11 -9
- data/sig/session.rbs +22 -23
- data/sig/transcoder/body.rbs +6 -1
- data/sig/transcoder/chunker.rbs +8 -2
- data/sig/transcoder/form.rbs +3 -1
- data/sig/transcoder/json.rbs +2 -0
- data/sig/transcoder.rbs +13 -5
- data/sig/utils.rbs +2 -0
- metadata +12 -2
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
|
|
|
@@ -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
|
@@ -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,16 +41,16 @@ 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
|
|
|
42
51
|
|
|
43
52
|
interface _SigV4Options
|
|
44
53
|
def sigv4_signer: () -> Signer?
|
|
45
|
-
def sigv4_signer=: (Signer) -> Signer
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
def self.extra_options: (Options) -> (Options & _SigV4Options)
|
|
@@ -59,6 +67,6 @@ module HTTPX
|
|
|
59
67
|
end
|
|
60
68
|
end
|
|
61
69
|
|
|
62
|
-
type awsSigV4Session = Session &
|
|
70
|
+
type awsSigV4Session = Session & AWSSigV4::InstanceMethods
|
|
63
71
|
end
|
|
64
72
|
end
|
|
@@ -10,6 +10,6 @@ module HTTPX
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
type sessionBasicAuthentication =
|
|
13
|
+
type sessionBasicAuthentication = sessionAuthentication & Authentication::InstanceMethods & BasicAuthentication::InstanceMethods
|
|
14
14
|
end
|
|
15
15
|
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
|
|
|
@@ -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
|
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
|
|
@@ -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
|
@@ -1,43 +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
|
-
type multipart_input = Enumerable[[string, multipart_value], untyped]
|
|
17
|
-
|
|
18
26
|
class Encoder
|
|
19
27
|
include Transcoder::_Encoder
|
|
20
|
-
|
|
28
|
+
|
|
29
|
+
@boundary: String
|
|
30
|
+
@part_index: Integer
|
|
31
|
+
@buffer: String
|
|
32
|
+
|
|
33
|
+
@form: Enumerable[[Symbol | string, multipart_nested_value]]
|
|
34
|
+
@parts: Array[_Reader]
|
|
21
35
|
|
|
22
36
|
def content_type: () -> String
|
|
23
37
|
|
|
38
|
+
def read: (?int? length, ?string? buffer) -> String?
|
|
39
|
+
|
|
40
|
+
def rewind: () -> void
|
|
41
|
+
|
|
24
42
|
private
|
|
25
43
|
|
|
26
|
-
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
|
|
27
47
|
|
|
28
48
|
def header_part: (string key, String content_type, String? filename) -> StringIO
|
|
29
49
|
|
|
30
|
-
def read_chunks: (String buffer, Integer? length) -> void
|
|
50
|
+
def read_chunks: (String buffer, ?Integer? length) -> void
|
|
51
|
+
|
|
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
|
|
31
71
|
|
|
32
|
-
def
|
|
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
|
|
33
84
|
end
|
|
34
85
|
|
|
35
86
|
module Part
|
|
36
|
-
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])
|
|
37
89
|
end
|
|
38
90
|
|
|
39
91
|
module MimeTypeDetector
|
|
40
|
-
|
|
92
|
+
DEFAULT_MIMETYPE: String
|
|
93
|
+
|
|
94
|
+
def self?.call: (::IO file, String filename) -> String?
|
|
41
95
|
end
|
|
42
96
|
end
|
|
43
97
|
end
|