httpx 0.24.6 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +0 -48
- data/README.md +4 -13
- data/doc/release_notes/0_24_4.md +3 -3
- data/doc/release_notes/1_0_0.md +60 -0
- data/doc/release_notes/1_0_1.md +5 -0
- data/lib/httpx/adapters/datadog.rb +28 -97
- data/lib/httpx/adapters/faraday.rb +9 -52
- data/lib/httpx/adapters/webmock.rb +2 -7
- data/lib/httpx/altsvc.rb +4 -22
- data/lib/httpx/base64.rb +27 -0
- data/lib/httpx/chainable.rb +0 -23
- data/lib/httpx/connection.rb +11 -32
- data/lib/httpx/domain_name.rb +5 -12
- data/lib/httpx/errors.rb +0 -2
- data/lib/httpx/extensions.rb +0 -124
- data/lib/httpx/io/ssl.rb +26 -59
- data/lib/httpx/io/tcp.rb +27 -68
- data/lib/httpx/io/udp.rb +13 -48
- data/lib/httpx/io/unix.rb +1 -8
- data/lib/httpx/loggable.rb +4 -19
- data/lib/httpx/options.rb +24 -84
- data/lib/httpx/plugins/{authentication → auth}/basic.rb +1 -5
- data/lib/httpx/plugins/{authentication → auth}/digest.rb +2 -5
- data/lib/httpx/plugins/{authentication → auth}/ntlm.rb +1 -3
- data/lib/httpx/plugins/{authentication → auth}/socks5.rb +0 -2
- data/lib/httpx/plugins/auth.rb +25 -0
- data/lib/httpx/plugins/aws_sigv4.rb +0 -1
- data/lib/httpx/plugins/{basic_authentication.rb → basic_auth.rb} +5 -6
- data/lib/httpx/plugins/brotli.rb +50 -0
- data/lib/httpx/plugins/circuit_breaker/circuit.rb +40 -16
- data/lib/httpx/plugins/circuit_breaker/circuit_store.rb +16 -5
- data/lib/httpx/plugins/circuit_breaker.rb +11 -4
- data/lib/httpx/plugins/cookies/set_cookie_parser.rb +0 -2
- data/lib/httpx/plugins/cookies.rb +1 -1
- data/lib/httpx/plugins/{digest_authentication.rb → digest_auth.rb} +5 -5
- data/lib/httpx/plugins/follow_redirects.rb +21 -24
- data/lib/httpx/plugins/grpc/grpc_encoding.rb +82 -0
- data/lib/httpx/plugins/grpc/message.rb +7 -39
- data/lib/httpx/plugins/grpc.rb +15 -21
- data/lib/httpx/plugins/h2c.rb +0 -1
- data/lib/httpx/plugins/{ntlm_authentication.rb → ntlm_auth.rb} +5 -5
- data/lib/httpx/plugins/oauth.rb +2 -2
- data/lib/httpx/plugins/proxy/http.rb +0 -2
- data/lib/httpx/plugins/proxy/socks4.rb +0 -4
- data/lib/httpx/plugins/proxy/socks5.rb +1 -5
- data/lib/httpx/plugins/proxy.rb +3 -32
- data/lib/httpx/plugins/retries.rb +3 -4
- data/lib/httpx/plugins/stream.rb +4 -6
- data/lib/httpx/punycode.rb +9 -291
- data/lib/httpx/request/body.rb +145 -0
- data/lib/httpx/request.rb +2 -119
- data/lib/httpx/resolver/https.rb +1 -1
- data/lib/httpx/resolver/native.rb +6 -14
- data/lib/httpx/resolver/resolver.rb +1 -1
- data/lib/httpx/resolver/system.rb +11 -9
- data/lib/httpx/response/body.rb +206 -0
- data/lib/httpx/response/buffer.rb +90 -0
- data/lib/httpx/response.rb +5 -208
- data/lib/httpx/selector.rb +0 -2
- data/lib/httpx/session.rb +0 -10
- data/lib/httpx/transcoder/body.rb +0 -1
- data/lib/httpx/transcoder/deflate.rb +37 -0
- data/lib/httpx/transcoder/form.rb +52 -32
- data/lib/httpx/transcoder/gzip.rb +74 -0
- data/lib/httpx/transcoder/json.rb +2 -4
- data/lib/httpx/transcoder/multipart/decoder.rb +139 -0
- data/lib/httpx/{plugins → transcoder}/multipart/encoder.rb +3 -3
- data/lib/httpx/{plugins → transcoder}/multipart/mime_type_detector.rb +1 -1
- data/lib/httpx/{plugins → transcoder}/multipart/part.rb +3 -2
- data/lib/httpx/transcoder/multipart.rb +17 -0
- data/lib/httpx/transcoder/utils/body_reader.rb +46 -0
- data/lib/httpx/transcoder/utils/deflater.rb +72 -0
- data/lib/httpx/transcoder/xml.rb +0 -2
- data/lib/httpx/transcoder.rb +2 -2
- data/lib/httpx/utils.rb +10 -20
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +0 -8
- data/sig/chainable.rbs +5 -6
- data/sig/connection.rbs +0 -1
- data/sig/errors.rbs +0 -3
- data/sig/httpx.rbs +2 -1
- data/sig/io/unix.rbs +1 -1
- data/sig/options.rbs +12 -8
- data/sig/plugins/{authentication → auth}/basic.rbs +0 -2
- data/sig/plugins/auth.rbs +13 -0
- data/sig/plugins/{basic_authentication.rbs → basic_auth.rbs} +2 -2
- data/sig/plugins/brotli.rbs +22 -0
- data/sig/plugins/circuit_breaker.rbs +7 -3
- data/sig/plugins/compression.rbs +0 -2
- data/sig/plugins/{digest_authentication.rbs → digest_auth.rbs} +2 -2
- data/sig/plugins/follow_redirects.rbs +0 -1
- data/sig/plugins/grpc/call.rbs +19 -0
- data/sig/plugins/grpc/grpc_encoding.rbs +33 -0
- data/sig/plugins/grpc/message.rbs +17 -0
- data/sig/plugins/grpc.rbs +2 -32
- data/sig/plugins/{ntlm_authentication.rbs → ntlm_auth.rbs} +2 -2
- data/sig/plugins/oauth.rbs +1 -1
- data/sig/plugins/proxy/socks4.rbs +2 -3
- data/sig/plugins/proxy/socks5.rbs +0 -1
- data/sig/plugins/proxy/ssh.rbs +1 -1
- data/sig/plugins/response_cache.rbs +5 -2
- data/sig/request/body.rbs +42 -0
- data/sig/request.rbs +1 -27
- data/sig/resolver/resolver.rbs +1 -1
- data/sig/response/body.rbs +52 -0
- data/sig/response/buffer.rbs +24 -0
- data/sig/response.rbs +0 -39
- data/sig/transcoder/body.rbs +4 -3
- data/sig/transcoder/deflate.rbs +11 -0
- data/sig/transcoder/form.rbs +5 -3
- data/sig/transcoder/gzip.rbs +24 -0
- data/sig/transcoder/json.rbs +4 -2
- data/sig/{plugins → transcoder}/multipart.rbs +3 -10
- data/sig/transcoder/utils/body_reader.rbs +15 -0
- data/sig/transcoder/utils/deflater.rbs +29 -0
- data/sig/transcoder.rbs +18 -2
- metadata +52 -34
- data/lib/httpx/plugins/authentication.rb +0 -24
- data/lib/httpx/plugins/compression/brotli.rb +0 -54
- data/lib/httpx/plugins/compression/deflate.rb +0 -54
- data/lib/httpx/plugins/compression/gzip.rb +0 -90
- data/lib/httpx/plugins/compression.rb +0 -165
- data/lib/httpx/plugins/multipart/decoder.rb +0 -137
- data/lib/httpx/plugins/multipart.rb +0 -96
- data/sig/plugins/authentication.rbs +0 -13
- data/sig/plugins/compression/brotli.rbs +0 -21
- data/sig/plugins/compression/deflate.rbs +0 -17
- data/sig/plugins/compression/gzip.rbs +0 -29
- /data/sig/plugins/{authentication → auth}/digest.rbs +0 -0
- /data/sig/plugins/{authentication → auth}/ntlm.rbs +0 -0
- /data/sig/plugins/{authentication → auth}/socks5.rbs +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module Brotli
|
4
|
+
def self?.load_dependencies: (singleton(Session)) -> void
|
5
|
+
|
6
|
+
def self?.encode: (body_encoder body) -> Deflater
|
7
|
+
|
8
|
+
def self?.decode: (HTTPX::Response response, ?bytesize: Integer) -> Transcoder::_Decoder
|
9
|
+
|
10
|
+
class Deflater < Transcoder::Deflater
|
11
|
+
end
|
12
|
+
|
13
|
+
module RequestBodyClassMethods
|
14
|
+
def initialize_deflater_body: (body_encoder body, Encoding | String encoding) -> body_encoder
|
15
|
+
end
|
16
|
+
|
17
|
+
module ResponseBodyClassMethods
|
18
|
+
def initialize_inflater_by_encoding: (Encoding | String encoding, Response response, ?bytesize: Integer) -> (Transcoder::_Decoder | Transcoder::GZIP::Inflater)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -3,15 +3,17 @@ module HTTPX
|
|
3
3
|
module CircuitBreaker
|
4
4
|
|
5
5
|
class CircuitStore
|
6
|
-
@circuits: Hash[String, Circuit]
|
6
|
+
@circuits: Hash[String, Circuit] & Mutex_m
|
7
7
|
|
8
|
-
def try_open: (
|
8
|
+
def try_open: (uri uri, response response) -> response?
|
9
9
|
|
10
10
|
def try_respond: (Request request) -> response?
|
11
11
|
|
12
|
+
def try_close: (http_uri uri) -> void
|
13
|
+
|
12
14
|
private
|
13
15
|
|
14
|
-
def get_circuit_for_uri: (
|
16
|
+
def get_circuit_for_uri: (uri uri) -> Circuit
|
15
17
|
|
16
18
|
def initialize: (Options & _CircuitOptions options) -> void
|
17
19
|
end
|
@@ -23,6 +25,8 @@ module HTTPX
|
|
23
25
|
@break_in: Float
|
24
26
|
@circuit_breaker_half_open_drip_rate: Float
|
25
27
|
@attempts: Integer
|
28
|
+
@real_attempts: Integer
|
29
|
+
@drip_factor: Integer
|
26
30
|
|
27
31
|
@response: response?
|
28
32
|
@opened_at: Float?
|
data/sig/plugins/compression.rbs
CHANGED
@@ -12,10 +12,10 @@ module HTTPX
|
|
12
12
|
def self.load_dependencies: (*untyped) -> void
|
13
13
|
|
14
14
|
module InstanceMethods
|
15
|
-
def
|
15
|
+
def digest_auth: (string user, string password, ?hashed: bool) -> instance
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
type sessionDigestAuth =
|
19
|
+
type sessionDigestAuth = sessionAuthorization & DigestAuth::InstanceMethods
|
20
20
|
end
|
21
21
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module GRPC
|
4
|
+
class Call
|
5
|
+
attr_writer decoder: _Callable
|
6
|
+
|
7
|
+
def metadata: () -> headers
|
8
|
+
|
9
|
+
def trailing_metadata: () -> headers?
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def initialize: (Response | StreamResponse response) -> untyped
|
14
|
+
|
15
|
+
def grpc_response: () -> grpc_response
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Transcoder
|
3
|
+
module GRPCEncoding
|
4
|
+
|
5
|
+
def self?.encode: (body_encoder body, compressed: bool) -> Deflater
|
6
|
+
|
7
|
+
def self?.decode: (Response | StreamResponse response) -> Inflater
|
8
|
+
|
9
|
+
class Deflater
|
10
|
+
attr_reader content_type: String
|
11
|
+
|
12
|
+
@body: BodyReader
|
13
|
+
@compressed: bool
|
14
|
+
|
15
|
+
def initialize: (body_encoder body, compressed: bool) -> void
|
16
|
+
|
17
|
+
def bytesize: () -> (Integer | Float)
|
18
|
+
|
19
|
+
def read: (?int? length, ?string outbuf) -> String?
|
20
|
+
end
|
21
|
+
|
22
|
+
class Inflater
|
23
|
+
@response: Response
|
24
|
+
@encodings: Array[String]
|
25
|
+
|
26
|
+
def initialize: (Response | StreamResponse response) -> void
|
27
|
+
|
28
|
+
def call: (String message) ?{ (String) -> void } -> String
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
module HTTPX
|
3
|
+
module Plugins
|
4
|
+
module GRPC
|
5
|
+
module Message
|
6
|
+
def self?.unary: (response) -> grpc_message
|
7
|
+
|
8
|
+
def self?.stream: (StreamResponse) { (String) -> void } -> void
|
9
|
+
| (StreamResponse) -> Enumerable[String]
|
10
|
+
|
11
|
+
def self?.cancel: (Request) -> void
|
12
|
+
|
13
|
+
def self?.verify_status: (StreamResponse | response) -> void
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/sig/plugins/grpc.rbs
CHANGED
@@ -17,36 +17,6 @@ module HTTPX
|
|
17
17
|
|
18
18
|
type credentials = Proc
|
19
19
|
|
20
|
-
class Call
|
21
|
-
attr_writer decoder: _Callable
|
22
|
-
|
23
|
-
def metadata: () -> headers
|
24
|
-
|
25
|
-
def trailing_metadata: () -> headers?
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def initialize: (Response | StreamResponse response) -> untyped
|
30
|
-
|
31
|
-
def grpc_response: () -> grpc_response
|
32
|
-
end
|
33
|
-
|
34
|
-
module Message
|
35
|
-
def self?.unary: (response) -> grpc_message
|
36
|
-
|
37
|
-
def self?.stream: (StreamResponse) { (String) -> void } -> void
|
38
|
-
| (StreamResponse) -> Enumerable[String]
|
39
|
-
|
40
|
-
def self?.encode: (String bytes, ?deflater: Compression::_Deflater?) -> String
|
41
|
-
|
42
|
-
def self?.decode: (String message, encodings: Array[String], encoders: Hash[String, Compression::_Compressor]) -> String
|
43
|
-
| (String message, encodings: Array[String], encoders: Hash[String, Compression::_Compressor]) { (String) -> void } -> void
|
44
|
-
|
45
|
-
def self?.cancel: (Request) -> void
|
46
|
-
|
47
|
-
def self?.verify_status: (StreamResponse | response) -> void
|
48
|
-
end
|
49
|
-
|
50
20
|
interface _GRPCOptions
|
51
21
|
def grpc_service: () -> String?
|
52
22
|
|
@@ -63,9 +33,9 @@ module HTTPX
|
|
63
33
|
def self.load_dependencies: (singleton(Session)) -> void
|
64
34
|
|
65
35
|
module ResponseMethods
|
66
|
-
|
36
|
+
attr_reader trailing_metadata: Hash[String, untyped]
|
67
37
|
|
68
|
-
def encoders: () ->
|
38
|
+
def encoders: () -> Array[String | Encoding]
|
69
39
|
end
|
70
40
|
|
71
41
|
module InstanceMethods
|
@@ -11,11 +11,11 @@ module HTTPX
|
|
11
11
|
def self.load_dependencies: (*untyped) -> void
|
12
12
|
|
13
13
|
module InstanceMethods
|
14
|
-
def
|
14
|
+
def ntlm_auth: (string user, string password, ?string? domain) -> instance
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
18
18
|
|
19
|
-
type sessionNTLMAuth =
|
19
|
+
type sessionNTLMAuth = sessionAuthorization & NTLMAuth::InstanceMethods
|
20
20
|
end
|
21
21
|
end
|
data/sig/plugins/oauth.rbs
CHANGED
@@ -4,17 +4,16 @@ module HTTPX
|
|
4
4
|
module Plugins
|
5
5
|
module Proxy
|
6
6
|
module Socks4
|
7
|
-
|
7
|
+
|
8
8
|
module ConnectionMethods
|
9
9
|
def __socks4_proxy_connect: () -> void
|
10
10
|
def __socks4_on_packet: (String packet) -> void
|
11
11
|
def on_socks4_error: (string) -> void
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
class SocksParser
|
15
15
|
include Callbacks
|
16
16
|
|
17
|
-
def timeout: () -> Integer
|
18
17
|
def close: () -> void
|
19
18
|
def consume: (*untyped) -> void
|
20
19
|
def empty: () -> bool
|
data/sig/plugins/proxy/ssh.rbs
CHANGED
@@ -2,9 +2,10 @@ module HTTPX
|
|
2
2
|
module Plugins
|
3
3
|
module ResponseCache
|
4
4
|
CACHEABLE_VERBS: Array[verb]
|
5
|
+
CACHEABLE_STATUS_CODES: Array[Integer]
|
5
6
|
|
6
|
-
def self?.cacheable_request?: (Request request) -> bool
|
7
|
-
def self?.cacheable_response?: (
|
7
|
+
def self?.cacheable_request?: (Request & RequestMethods request) -> bool
|
8
|
+
def self?.cacheable_response?: (::HTTPX::ErrorResponse | (Response & ResponseMethods) response) -> bool
|
8
9
|
def self?.cached_response?: (response response) -> bool
|
9
10
|
|
10
11
|
class Store
|
@@ -34,6 +35,8 @@ module HTTPX
|
|
34
35
|
end
|
35
36
|
|
36
37
|
module RequestMethods
|
38
|
+
@response_cache_key: String
|
39
|
+
|
37
40
|
def response_cache_key: () -> String
|
38
41
|
end
|
39
42
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class Request::Body
|
3
|
+
attr_reader threshold_size: Integer?
|
4
|
+
|
5
|
+
@headers: Headers
|
6
|
+
@body: body_encoder?
|
7
|
+
@unbounded_body: bool
|
8
|
+
|
9
|
+
def initialize: (Headers headers, Options options) -> void
|
10
|
+
|
11
|
+
def each: () { (String) -> void } -> void
|
12
|
+
| () -> Enumerable[String]
|
13
|
+
|
14
|
+
def rewind: () -> void
|
15
|
+
|
16
|
+
def empty?: () -> bool
|
17
|
+
|
18
|
+
def bytesize: () -> (Integer | Float)
|
19
|
+
|
20
|
+
def stream: (Transcoder::_Encoder) -> bodyIO
|
21
|
+
|
22
|
+
def unbounded_body?: () -> bool
|
23
|
+
|
24
|
+
def chunked?: () -> bool
|
25
|
+
|
26
|
+
def chunk!: () -> void
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def initialize_body: (Options options) -> void
|
31
|
+
|
32
|
+
def self.initialize_deflater_body: (body_encoder body, Encoding | String encoding) -> body_encoder
|
33
|
+
end
|
34
|
+
|
35
|
+
class ProcIO
|
36
|
+
@block: ^(String) -> void
|
37
|
+
|
38
|
+
def initialize: (^(String) -> void) -> untyped
|
39
|
+
|
40
|
+
def write: (String data) -> Integer
|
41
|
+
end
|
42
|
+
end
|
data/sig/request.rbs
CHANGED
@@ -7,7 +7,7 @@ module HTTPX
|
|
7
7
|
USER_AGENT: String
|
8
8
|
|
9
9
|
attr_reader verb: verb
|
10
|
-
attr_reader uri:
|
10
|
+
attr_reader uri: http_uri
|
11
11
|
attr_reader headers: Headers
|
12
12
|
attr_reader body: Body
|
13
13
|
attr_reader state: Symbol
|
@@ -60,31 +60,5 @@ module HTTPX
|
|
60
60
|
|
61
61
|
def initialize_body: (Options options) -> Transcoder::_Encoder?
|
62
62
|
|
63
|
-
class Body
|
64
|
-
@headers: Headers
|
65
|
-
@body: body_encoder?
|
66
|
-
@unbounded_body: bool
|
67
|
-
|
68
|
-
def initialize: (Headers, Options) -> untyped
|
69
|
-
def each: () { (String) -> void } -> void
|
70
|
-
| () -> Enumerable[String]
|
71
|
-
|
72
|
-
def rewind: () -> void
|
73
|
-
def empty?: () -> bool
|
74
|
-
def bytesize: () -> (Integer | Float)
|
75
|
-
def stream: (Transcoder::_Encoder) -> bodyIO
|
76
|
-
def unbounded_body?: () -> bool
|
77
|
-
def chunked?: () -> bool
|
78
|
-
def chunk!: () -> void
|
79
|
-
def inspect: () -> String
|
80
|
-
end
|
81
|
-
|
82
|
-
class ProcIO
|
83
|
-
@block: ^(String) -> void
|
84
|
-
|
85
|
-
def initialize: (^(String) -> void) -> untyped
|
86
|
-
|
87
|
-
def write: (String data) -> Integer
|
88
|
-
end
|
89
63
|
end
|
90
64
|
end
|
data/sig/resolver/resolver.rbs
CHANGED
@@ -30,7 +30,7 @@ module HTTPX
|
|
30
30
|
|
31
31
|
def emit_resolve_error: (Connection connection, ?String hostname, ?StandardError) -> void
|
32
32
|
|
33
|
-
def resolve_error: (String hostname, ?StandardError?) -> ResolveError
|
33
|
+
def resolve_error: (String hostname, ?StandardError?) -> (ResolveError | ResolveTimeoutError)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class Response::Body
|
3
|
+
include _Reader
|
4
|
+
include _ToS
|
5
|
+
include _ToStr
|
6
|
+
|
7
|
+
attr_reader encoding: Encoding | String
|
8
|
+
attr_reader encodings: Array[Encoding | String]
|
9
|
+
|
10
|
+
@response: Response
|
11
|
+
@headers: Headers
|
12
|
+
@options: Options
|
13
|
+
@state: :idle | :memory | :buffer | :closed
|
14
|
+
@threshold_size: Integer
|
15
|
+
@window_size: Integer
|
16
|
+
@length: Integer
|
17
|
+
@buffer: StringIO | Tempfile | nil
|
18
|
+
@reader: StringIO | Tempfile | nil
|
19
|
+
@inflaters: Array[Transcoder::_Inflater]
|
20
|
+
|
21
|
+
def initialize: (Response, Options) -> void
|
22
|
+
|
23
|
+
def closed?: () -> bool
|
24
|
+
|
25
|
+
def write:(String chunk) -> Integer?
|
26
|
+
|
27
|
+
def filename: () -> String?
|
28
|
+
|
29
|
+
def bytesize: () -> Integer
|
30
|
+
|
31
|
+
def each: () { (String) -> void } -> void
|
32
|
+
| () -> Enumerable[String]
|
33
|
+
|
34
|
+
def empty?: () -> bool
|
35
|
+
|
36
|
+
def copy_to: (String | File | _Writer destination) -> void
|
37
|
+
|
38
|
+
def close: () -> void
|
39
|
+
|
40
|
+
def rewind: () -> void
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def initialize_inflaters: () -> void
|
45
|
+
|
46
|
+
def self.initialize_inflater_by_encoding: (Encoding | String encoding, Response response, ?bytesize: Integer) -> Transcoder::GZIP::Inflater
|
47
|
+
|
48
|
+
def transition: (Symbol nextstate) -> void
|
49
|
+
|
50
|
+
def _with_same_buffer_pos: [A] () { () -> A } -> A
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module HTTPX
|
2
|
+
class Response::Buffer
|
3
|
+
@threshold_size: Integer
|
4
|
+
@bytesize: Integer
|
5
|
+
@encoding: Encoding
|
6
|
+
@buffer: StringIO | Tempfile
|
7
|
+
|
8
|
+
def initialize: (threshold_size: Integer, ?bytesize: Integer, ?encoding: Encoding | String) -> void
|
9
|
+
|
10
|
+
def size: () -> Integer
|
11
|
+
|
12
|
+
def write: (String) -> void
|
13
|
+
|
14
|
+
def to_s: () -> String
|
15
|
+
|
16
|
+
def close: () -> void
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def try_upgrade_buffer: () -> void
|
21
|
+
|
22
|
+
def _with_same_buffer_pos: () { () -> void } -> void
|
23
|
+
end
|
24
|
+
end
|
data/sig/response.rbs
CHANGED
@@ -43,45 +43,6 @@ module HTTPX
|
|
43
43
|
def no_data?: () -> bool
|
44
44
|
|
45
45
|
def decode:(Transcoder::_Decode transcoder, ?untyped options) -> untyped
|
46
|
-
|
47
|
-
class Body
|
48
|
-
include _Reader
|
49
|
-
include _ToS
|
50
|
-
include _ToStr
|
51
|
-
|
52
|
-
attr_reader encoding: Encoding | String
|
53
|
-
|
54
|
-
@response: Response
|
55
|
-
@headers: Headers
|
56
|
-
@options: Options
|
57
|
-
@state: :idle | :memory | :buffer | :closed
|
58
|
-
@threshold_size: Integer
|
59
|
-
@window_size: Integer
|
60
|
-
@length: Integer
|
61
|
-
@buffer: StringIO | Tempfile | nil
|
62
|
-
@reader: StringIO | Tempfile | nil
|
63
|
-
|
64
|
-
def write:(String chunk) -> Integer?
|
65
|
-
|
66
|
-
def each: () { (String) -> void } -> void
|
67
|
-
| () -> Enumerable[String]
|
68
|
-
|
69
|
-
def filename: () -> String?
|
70
|
-
|
71
|
-
def bytesize: () -> (Integer | Float)
|
72
|
-
def empty?: () -> bool
|
73
|
-
def copy_to: (String | File | _Writer destination) -> void
|
74
|
-
def close: () -> void
|
75
|
-
def closed?: () -> bool
|
76
|
-
|
77
|
-
def rewind: () -> void
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
def initialize: (Response, Options) -> void
|
82
|
-
def transition: () -> void
|
83
|
-
def _with_same_buffer_pos: [A] () { () -> A } -> A
|
84
|
-
end
|
85
46
|
end
|
86
47
|
|
87
48
|
class ContentType
|
data/sig/transcoder/body.rbs
CHANGED
@@ -7,13 +7,14 @@ module HTTPX
|
|
7
7
|
class Encoder
|
8
8
|
extend Forwardable
|
9
9
|
|
10
|
-
include _Encoder
|
11
|
-
include _ToS
|
12
|
-
|
13
10
|
@raw: bodyIO
|
14
11
|
|
12
|
+
def bytesize: () -> (Integer | Float)
|
13
|
+
|
15
14
|
def content_type: () -> String
|
16
15
|
|
16
|
+
def to_s: () -> String
|
17
|
+
|
17
18
|
private
|
18
19
|
|
19
20
|
def initialize: (untyped body) -> untyped
|
data/sig/transcoder/form.rbs
CHANGED
@@ -3,17 +3,19 @@ module HTTPX::Transcoder
|
|
3
3
|
|
4
4
|
type form_nested_value = form_value | _ToAry[form_value] | _ToHash[string, form_value]
|
5
5
|
|
6
|
-
type urlencoded_input = Enumerable[[_ToS, form_nested_value]]
|
6
|
+
type urlencoded_input = Enumerable[[_ToS, form_nested_value | Multipart::multipart_nested_value]]
|
7
7
|
|
8
8
|
module Form
|
9
|
-
def self?.encode: (urlencoded_input form) -> Encoder
|
9
|
+
def self?.encode: (urlencoded_input form) -> (Encoder | Multipart::Encoder)
|
10
10
|
def self?.decode: (HTTPX::Response response) -> _Decoder
|
11
|
+
def self?.multipart?: (form_nested_value | Multipart::multipart_nested_value data) -> bool
|
11
12
|
|
12
13
|
class Encoder
|
13
14
|
extend Forwardable
|
14
|
-
include _Encoder
|
15
15
|
include _ToS
|
16
16
|
|
17
|
+
def bytesize: () -> Integer
|
18
|
+
|
17
19
|
def content_type: () -> String
|
18
20
|
|
19
21
|
private
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Transcoder
|
3
|
+
module GZIP
|
4
|
+
def self?.encode: (_Encoder body) -> Deflater
|
5
|
+
def self?.decode: (Response response, ?bytesize: Integer) -> Inflater
|
6
|
+
|
7
|
+
class Deflater < Transcoder::Deflater
|
8
|
+
@compressed_chunk: String
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def write: (String chunk) -> void
|
13
|
+
|
14
|
+
def compressed_chunk: () -> String
|
15
|
+
end
|
16
|
+
|
17
|
+
class Inflater
|
18
|
+
def initialize: (Integer | Float bytesize) -> void
|
19
|
+
|
20
|
+
def call: (String chunk) -> String
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/sig/transcoder/json.rbs
CHANGED
@@ -10,14 +10,16 @@ module HTTPX::Transcoder
|
|
10
10
|
|
11
11
|
class Encoder
|
12
12
|
extend Forwardable
|
13
|
-
include _Encoder
|
14
|
-
include _ToS
|
15
13
|
|
16
14
|
@raw: String
|
17
15
|
@charset: String
|
18
16
|
|
17
|
+
def bytesize: () -> Integer
|
18
|
+
|
19
19
|
def content_type: () -> String
|
20
20
|
|
21
|
+
def to_s: () -> String
|
22
|
+
|
21
23
|
private
|
22
24
|
|
23
25
|
def initialize: (_ToJson json) -> void
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module HTTPX
|
2
|
-
module
|
2
|
+
module Transcoder
|
3
3
|
module Multipart
|
4
4
|
interface _MultipartInput
|
5
5
|
def filename: () -> String
|
@@ -9,13 +9,6 @@ module HTTPX
|
|
9
9
|
|
10
10
|
MULTIPART_VALUE_COND: ^(_Reader | record_multipart_value value) -> bool
|
11
11
|
|
12
|
-
def self.load_dependencies: (singleton(Session)) -> void
|
13
|
-
def self.configure: (*untyped) -> void
|
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
|
18
|
-
|
19
12
|
type multipart_value = string | Pathname | File | _Reader
|
20
13
|
|
21
14
|
type record_multipart_value = { content_type: String, filename: String, body: multipart_value } |
|
@@ -24,8 +17,6 @@ module HTTPX
|
|
24
17
|
type multipart_nested_value = multipart_value | _ToAry[multipart_value] | _ToHash[string, multipart_value]
|
25
18
|
|
26
19
|
class Encoder
|
27
|
-
include Transcoder::_Encoder
|
28
|
-
|
29
20
|
@boundary: String
|
30
21
|
@part_index: Integer
|
31
22
|
@buffer: String
|
@@ -33,6 +24,8 @@ module HTTPX
|
|
33
24
|
@form: Enumerable[[Symbol | string, multipart_nested_value]]
|
34
25
|
@parts: Array[_Reader]
|
35
26
|
|
27
|
+
def bytesize: () -> Integer
|
28
|
+
|
36
29
|
def content_type: () -> String
|
37
30
|
|
38
31
|
def read: (?int? length, ?string? buffer) -> String?
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Transcoder
|
3
|
+
class BodyReader
|
4
|
+
@body: _Reader | _Each[String]
|
5
|
+
|
6
|
+
def initialize: (bodyIO body) -> void
|
7
|
+
|
8
|
+
def bytesize: () -> (Integer | Float)
|
9
|
+
|
10
|
+
def read: (?int? length, ?string outbuf) -> String?
|
11
|
+
|
12
|
+
def close: () -> void
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|