httpx 1.3.3 → 1.4.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/1_3_3.md +1 -1
- data/doc/release_notes/1_3_4.md +6 -0
- data/doc/release_notes/1_4_0.md +43 -0
- data/lib/httpx/adapters/faraday.rb +2 -0
- data/lib/httpx/adapters/webmock.rb +11 -5
- data/lib/httpx/callbacks.rb +0 -5
- data/lib/httpx/chainable.rb +3 -1
- data/lib/httpx/connection/http2.rb +11 -7
- data/lib/httpx/connection.rb +128 -16
- data/lib/httpx/errors.rb +12 -0
- data/lib/httpx/loggable.rb +5 -5
- data/lib/httpx/options.rb +26 -16
- data/lib/httpx/plugins/aws_sigv4.rb +31 -16
- data/lib/httpx/plugins/callbacks.rb +12 -2
- data/lib/httpx/plugins/circuit_breaker.rb +0 -5
- data/lib/httpx/plugins/content_digest.rb +202 -0
- data/lib/httpx/plugins/expect.rb +4 -3
- data/lib/httpx/plugins/follow_redirects.rb +7 -8
- data/lib/httpx/plugins/h2c.rb +23 -20
- data/lib/httpx/plugins/internal_telemetry.rb +27 -0
- data/lib/httpx/plugins/persistent.rb +16 -0
- data/lib/httpx/plugins/proxy/http.rb +17 -19
- data/lib/httpx/plugins/proxy.rb +91 -93
- data/lib/httpx/plugins/retries.rb +5 -8
- data/lib/httpx/plugins/upgrade.rb +5 -10
- data/lib/httpx/plugins/webdav.rb +6 -0
- data/lib/httpx/plugins/xml.rb +76 -0
- data/lib/httpx/pool.rb +73 -244
- data/lib/httpx/request/body.rb +16 -12
- data/lib/httpx/request.rb +1 -1
- data/lib/httpx/resolver/https.rb +12 -19
- data/lib/httpx/resolver/multi.rb +34 -16
- data/lib/httpx/resolver/native.rb +36 -13
- data/lib/httpx/resolver/resolver.rb +49 -11
- data/lib/httpx/resolver/system.rb +29 -11
- data/lib/httpx/resolver.rb +21 -14
- data/lib/httpx/response/body.rb +12 -1
- data/lib/httpx/response.rb +5 -3
- data/lib/httpx/selector.rb +164 -95
- data/lib/httpx/session.rb +296 -139
- data/lib/httpx/transcoder/gzip.rb +0 -3
- data/lib/httpx/transcoder/json.rb +14 -2
- data/lib/httpx/transcoder/multipart/encoder.rb +3 -1
- data/lib/httpx/transcoder/utils/deflater.rb +7 -4
- data/lib/httpx/transcoder/utils/inflater.rb +2 -0
- data/lib/httpx/transcoder.rb +0 -1
- data/lib/httpx/version.rb +1 -1
- data/lib/httpx.rb +19 -20
- data/sig/callbacks.rbs +0 -1
- data/sig/chainable.rbs +4 -0
- data/sig/connection/http2.rbs +1 -1
- data/sig/connection.rbs +14 -3
- data/sig/errors.rbs +6 -0
- data/sig/loggable.rbs +2 -0
- data/sig/options.rbs +7 -0
- data/sig/plugins/aws_sigv4.rbs +8 -2
- data/sig/plugins/content_digest.rbs +51 -0
- data/sig/plugins/cookies/cookie.rbs +9 -0
- data/sig/plugins/grpc/call.rbs +4 -0
- data/sig/plugins/persistent.rbs +4 -1
- data/sig/plugins/proxy/socks5.rbs +11 -3
- data/sig/plugins/proxy.rbs +18 -11
- data/sig/plugins/push_promise.rbs +3 -0
- data/sig/plugins/rate_limiter.rbs +2 -0
- data/sig/plugins/retries.rbs +1 -1
- data/sig/plugins/ssrf_filter.rbs +26 -0
- data/sig/plugins/webdav.rbs +23 -0
- data/sig/plugins/xml.rbs +37 -0
- data/sig/pool.rbs +25 -33
- data/sig/request/body.rbs +5 -1
- data/sig/resolver/multi.rbs +26 -1
- data/sig/resolver/native.rbs +0 -2
- data/sig/resolver/resolver.rbs +21 -2
- data/sig/resolver.rbs +5 -1
- data/sig/response/body.rbs +2 -2
- data/sig/response/buffer.rbs +2 -2
- data/sig/selector.rbs +30 -4
- data/sig/session.rbs +45 -18
- data/sig/transcoder/body.rbs +1 -1
- data/sig/transcoder/chunker.rbs +1 -1
- data/sig/transcoder/deflate.rbs +1 -0
- data/sig/transcoder/form.rbs +8 -0
- data/sig/transcoder/gzip.rbs +4 -1
- data/sig/transcoder/multipart.rbs +3 -3
- data/sig/transcoder/utils/body_reader.rbs +2 -2
- data/sig/transcoder/utils/deflater.rbs +2 -2
- metadata +12 -4
- data/lib/httpx/transcoder/xml.rb +0 -52
- data/sig/transcoder/xml.rbs +0 -22
data/sig/resolver/native.rbs
CHANGED
data/sig/resolver/resolver.rbs
CHANGED
@@ -6,8 +6,17 @@ module HTTPX
|
|
6
6
|
|
7
7
|
RECORD_TYPES: Hash[Integer, singleton(Resolv::DNS::Resource)]
|
8
8
|
|
9
|
+
attr_reader family: ip_family
|
10
|
+
|
11
|
+
attr_reader options: Options
|
12
|
+
|
13
|
+
attr_writer current_selector: Selector?
|
14
|
+
|
15
|
+
attr_writer current_session: Session?
|
16
|
+
|
17
|
+
attr_accessor multi: Multi?
|
18
|
+
|
9
19
|
@record_type: singleton(Resolv::DNS::Resource)
|
10
|
-
@options: Options
|
11
20
|
@resolver_options: Hash[Symbol, untyped]
|
12
21
|
@queries: Hash[String, Connection]
|
13
22
|
@system_resolver: Resolv::Hosts
|
@@ -20,6 +29,8 @@ module HTTPX
|
|
20
29
|
|
21
30
|
def empty?: () -> bool
|
22
31
|
|
32
|
+
def each_connection: () { (Connection connection) -> void } -> void
|
33
|
+
|
23
34
|
def emit_addresses: (Connection connection, ip_family family, Array[IPAddr], ?bool early_resolve) -> void
|
24
35
|
|
25
36
|
private
|
@@ -28,7 +39,15 @@ module HTTPX
|
|
28
39
|
|
29
40
|
def initialize: (ip_family? family, Options options) -> void
|
30
41
|
|
31
|
-
def early_resolve: (Connection connection, ?hostname: String) ->
|
42
|
+
def early_resolve: (Connection connection, ?hostname: String) -> bool
|
43
|
+
|
44
|
+
def set_resolver_callbacks: () -> void
|
45
|
+
|
46
|
+
def resolve_connection: (Connection connection) -> void
|
47
|
+
|
48
|
+
def emit_connection_error: (Connection connection, StandardError error) -> void
|
49
|
+
|
50
|
+
def close_resolver: (Resolver resolver) -> void
|
32
51
|
|
33
52
|
def emit_resolve_error: (Connection connection, ?String hostname, ?StandardError) -> void
|
34
53
|
|
data/sig/resolver.rbs
CHANGED
@@ -28,12 +28,16 @@ module HTTPX
|
|
28
28
|
|
29
29
|
def self?.cached_lookup_set: (String hostname, ip_family family, Array[dns_result] addresses) -> void
|
30
30
|
|
31
|
-
def self?.lookup: (String hostname, Numeric ttl) -> Array[IPAddr]?
|
31
|
+
def self?.lookup: (String hostname, Hash[String, Array[dns_result]] lookups, Numeric ttl) -> Array[IPAddr]?
|
32
32
|
|
33
33
|
def self?.generate_id: () -> Integer
|
34
34
|
|
35
35
|
def self?.encode_dns_query: (String hostname, ?type: dns_resource, ?message_id: Integer) -> String
|
36
36
|
|
37
37
|
def self?.decode_dns_answer: (String) -> dns_decoding_response
|
38
|
+
|
39
|
+
def self?.lookup_synchronize: [U] () { (Hash[String, Array[dns_result]] lookups) -> U } -> U
|
40
|
+
|
41
|
+
def self?.id_synchronize: () { () -> void } -> void
|
38
42
|
end
|
39
43
|
end
|
data/sig/response/body.rbs
CHANGED
data/sig/response/buffer.rbs
CHANGED
@@ -5,11 +5,11 @@ module HTTPX
|
|
5
5
|
@encoding: Encoding
|
6
6
|
@buffer: StringIO | Tempfile
|
7
7
|
|
8
|
-
def initialize: (threshold_size: Integer, ?bytesize: Integer, ?encoding: Encoding
|
8
|
+
def initialize: (threshold_size: Integer, ?bytesize: Integer, ?encoding: Encoding) -> void
|
9
9
|
|
10
10
|
def size: () -> Integer
|
11
11
|
|
12
|
-
def write: (String) ->
|
12
|
+
def write: (String chunk) -> Integer
|
13
13
|
|
14
14
|
def to_s: () -> String
|
15
15
|
|
data/sig/selector.rbs
CHANGED
@@ -1,22 +1,48 @@
|
|
1
1
|
module HTTPX
|
2
|
+
type selectable = Connection | Resolver::Native
|
3
|
+
|
2
4
|
class Selector
|
3
|
-
|
5
|
+
include _Each[selectable]
|
4
6
|
|
5
7
|
READABLE: Array[Symbol]
|
6
8
|
WRITABLE: Array[Symbol]
|
9
|
+
|
10
|
+
@timers: Timers
|
11
|
+
|
7
12
|
@selectables: Array[selectable]
|
8
13
|
|
14
|
+
def next_tick: () -> void
|
15
|
+
|
16
|
+
def terminate: () -> void
|
17
|
+
|
18
|
+
def find_resolver: (Options options) -> Resolver::Resolver?
|
19
|
+
|
20
|
+
def find_connection: (http_uri request_uri, Options options) -> Connection?
|
21
|
+
|
22
|
+
def each_connection: () { (Connection) -> void} -> void
|
23
|
+
| () -> Enumerable[Connection]
|
24
|
+
|
25
|
+
def find_mergeable_connection: (Connection connection) -> Connection?
|
26
|
+
|
27
|
+
def empty?: () -> bool
|
28
|
+
|
9
29
|
def register: (selectable io) -> void
|
10
|
-
def deregister: (selectable io) -> selectable?
|
11
30
|
|
12
|
-
def
|
31
|
+
def deregister: (selectable io) -> selectable?
|
13
32
|
|
14
33
|
private
|
15
34
|
|
16
|
-
def initialize: () ->
|
35
|
+
def initialize: () -> void
|
36
|
+
|
37
|
+
def select: (Numeric? interval) { (selectable) -> void } -> void
|
17
38
|
|
18
39
|
def select_many: (Numeric? interval) { (selectable) -> void } -> void
|
40
|
+
|
19
41
|
def select_one: (Numeric? interval) { (selectable) -> void } -> void
|
42
|
+
|
43
|
+
def next_timeout: () -> Numeric?
|
44
|
+
|
45
|
+
def emit_error: (StandardError e) -> void
|
20
46
|
end
|
21
47
|
|
22
48
|
type io_interests = :r | :w | :rw
|
data/sig/session.rbs
CHANGED
@@ -7,40 +7,50 @@ module HTTPX
|
|
7
7
|
|
8
8
|
@options: Options
|
9
9
|
@responses: Hash[Request, response]
|
10
|
-
|
10
|
+
|
11
|
+
# returns the HTTPX::Pool object which manages the networking required to
|
12
|
+
# perform requests.
|
13
|
+
@pool: Pool
|
14
|
+
|
15
|
+
@persistent: bool
|
16
|
+
@wrapped: bool
|
11
17
|
|
12
18
|
def self.plugin: (Symbol | Module plugin, ?options? options) ?{ (Class) -> void } -> singleton(Session)
|
13
19
|
|
14
20
|
def wrap: () { (instance) -> void } -> void
|
15
21
|
|
16
|
-
def close: (
|
22
|
+
def close: (?Selector selector) -> void
|
17
23
|
|
18
24
|
def build_request: (verb verb, generic_uri uri, ?request_params params, ?Options options) -> Request
|
19
25
|
|
20
|
-
def
|
21
|
-
| (?options) -> void
|
26
|
+
def select_connection: (Connection connection, Selector selector) -> void
|
22
27
|
|
23
|
-
|
28
|
+
def deselect_connection: (Connection connection, Selector selector, ?bool cloned) -> void
|
24
29
|
|
25
|
-
def
|
30
|
+
def select_resolver: (Resolver::Native | Resolver::HTTPS resolver, Selector selector) -> void
|
26
31
|
|
27
|
-
def
|
32
|
+
def deselect_resolver: (Resolver::Resolver resolver, Selector selector) -> void
|
28
33
|
|
29
|
-
def
|
34
|
+
def try_clone_connection: (Connection connection, Selector selector, Integer? family) -> Connection
|
30
35
|
|
31
|
-
def
|
36
|
+
def find_connection: (http_uri request_uri, Selector selector, Options options) -> Connection
|
32
37
|
|
33
|
-
|
38
|
+
private
|
34
39
|
|
35
|
-
def
|
40
|
+
def initialize: (?options) { (self) -> void } -> void
|
41
|
+
| (?options) -> void
|
36
42
|
|
37
|
-
def
|
43
|
+
def deactivate: (Selector selector) -> void
|
38
44
|
|
39
|
-
def
|
45
|
+
def on_response: (Request, response) -> void
|
40
46
|
|
41
|
-
def
|
47
|
+
def on_promise: (untyped, untyped) -> void
|
48
|
+
|
49
|
+
def fetch_response: (Request request, Selector selector, Options options) -> response?
|
50
|
+
|
51
|
+
def send_request: (Request request, Selector selector, ?Options options) -> void
|
42
52
|
|
43
|
-
def
|
53
|
+
def set_request_callbacks: (Request request) -> void
|
44
54
|
|
45
55
|
def build_requests: (verb, uri, request_params) -> Array[Request]
|
46
56
|
| (Array[[verb, uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
|
@@ -48,13 +58,30 @@ module HTTPX
|
|
48
58
|
| (verb, _Each[[uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
|
49
59
|
| (verb, _Each[uri], request_params) -> Array[Request]
|
50
60
|
|
51
|
-
def
|
61
|
+
def do_init_connection: (Connection connection, Selector selector) -> void
|
52
62
|
|
53
63
|
def send_requests: (*Request) -> Array[response]
|
54
64
|
|
55
|
-
def _send_requests: (Array[Request] requests) ->
|
65
|
+
def _send_requests: (Array[Request] requests, Selector selector) -> void
|
66
|
+
|
67
|
+
def receive_requests: (Array[Request] requests, Selector selector) -> Array[response]
|
68
|
+
|
69
|
+
def resolve_connection: (Connection connection, Selector selector) -> void
|
70
|
+
|
71
|
+
def on_resolver_connection: (Connection connection, Selector selector) -> void
|
72
|
+
|
73
|
+
def on_resolver_close: (Resolver::Resolver resolver, Selector selector) -> void
|
74
|
+
|
75
|
+
def find_resolver_for: (Connection connection, Selector selector) -> (Resolver::Multi | Resolver::Resolver)
|
76
|
+
|
77
|
+
def coalesce_connections: (Connection conn1, Connection conn2, Selector selector, bool from_pool) -> bool
|
78
|
+
|
79
|
+
def get_current_selector: () -> Selector?
|
80
|
+
| () { () -> Selector } -> Selector
|
81
|
+
|
82
|
+
def set_current_selector: (Selector? selector) -> void
|
56
83
|
|
57
|
-
def
|
84
|
+
def selector_store: () -> Hash[instance, Selector]
|
58
85
|
|
59
86
|
attr_reader self.default_options: Options
|
60
87
|
end
|
data/sig/transcoder/body.rbs
CHANGED
data/sig/transcoder/chunker.rbs
CHANGED
data/sig/transcoder/deflate.rbs
CHANGED
data/sig/transcoder/form.rbs
CHANGED
@@ -6,6 +6,8 @@ module HTTPX::Transcoder
|
|
6
6
|
type urlencoded_input = Enumerable[[_ToS, form_nested_value | Multipart::multipart_nested_value]]
|
7
7
|
|
8
8
|
module Form
|
9
|
+
PARAM_DEPTH_LIMIT: Integer
|
10
|
+
|
9
11
|
def self?.encode: (urlencoded_input form) -> (Encoder | Multipart::Encoder)
|
10
12
|
def self?.decode: (HTTPX::Response response) -> _Decoder
|
11
13
|
def self?.multipart?: (form_nested_value | Multipart::multipart_nested_value data) -> bool
|
@@ -14,6 +16,8 @@ module HTTPX::Transcoder
|
|
14
16
|
extend Forwardable
|
15
17
|
include _ToS
|
16
18
|
|
19
|
+
@raw: String
|
20
|
+
|
17
21
|
def bytesize: () -> Integer
|
18
22
|
|
19
23
|
def content_type: () -> String
|
@@ -22,5 +26,9 @@ module HTTPX::Transcoder
|
|
22
26
|
|
23
27
|
def initialize: (urlencoded_input form) -> untyped
|
24
28
|
end
|
29
|
+
|
30
|
+
module Decoder
|
31
|
+
def self?.call: (HTTPX::Response response, *untyped) -> Hash[String, untyped]
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
data/sig/transcoder/gzip.rbs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Transcoder
|
3
3
|
module GZIP
|
4
|
-
def self?.encode: (
|
4
|
+
def self?.encode: (body_encoder body) -> Deflater
|
5
5
|
def self?.decode: (Response response, ?bytesize: Integer) -> Inflater
|
6
6
|
|
7
7
|
class Deflater < Transcoder::Deflater
|
@@ -15,6 +15,9 @@ module HTTPX
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class Inflater
|
18
|
+
@inflater: Zlib::Inflate
|
19
|
+
@bytesize: Integer
|
20
|
+
|
18
21
|
def initialize: (Integer | Float bytesize) -> void
|
19
22
|
|
20
23
|
def call: (String chunk) -> String
|
@@ -9,7 +9,7 @@ module HTTPX
|
|
9
9
|
|
10
10
|
MULTIPART_VALUE_COND: ^(_Reader | record_multipart_value value) -> bool
|
11
11
|
|
12
|
-
type multipart_value = string | Pathname | File | _Reader
|
12
|
+
type multipart_value = string | Pathname | File | Tempfile | _Reader
|
13
13
|
|
14
14
|
type record_multipart_value = { content_type: String, filename: String, body: multipart_value } |
|
15
15
|
{ content_type: String, body: multipart_value }
|
@@ -83,13 +83,13 @@ module HTTPX
|
|
83
83
|
|
84
84
|
module Part
|
85
85
|
def self?.call: [U] (Object & _MultipartInput multipart_input) -> [U, String, String]
|
86
|
-
| (
|
86
|
+
| (multipart_nested_value value) -> ([StringIO, String, String?] | [File | Tempfile, String, String])
|
87
87
|
end
|
88
88
|
|
89
89
|
module MimeTypeDetector
|
90
90
|
DEFAULT_MIMETYPE: String
|
91
91
|
|
92
|
-
def self?.call: (::IO file, String filename) -> String?
|
92
|
+
def self?.call: (::IO | Tempfile file, String filename) -> String?
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Transcoder
|
3
3
|
class BodyReader
|
4
|
-
@body: _Reader | _Each[String]
|
4
|
+
@body: Object & (_Reader | _Each[String])
|
5
5
|
|
6
|
-
def initialize: (
|
6
|
+
def initialize: (body_encoder body) -> void
|
7
7
|
|
8
8
|
def bytesize: () -> (Integer | Float)
|
9
9
|
|
@@ -5,12 +5,12 @@ module HTTPX
|
|
5
5
|
|
6
6
|
@body: BodyReader
|
7
7
|
@buffer: Response::Buffer?
|
8
|
-
@body:
|
8
|
+
@body: BodyReader
|
9
9
|
@closed: bool
|
10
10
|
|
11
11
|
attr_reader content_type: String
|
12
12
|
|
13
|
-
def initialize: (
|
13
|
+
def initialize: (body_encoder body) -> void
|
14
14
|
|
15
15
|
def bytesize: () -> (Integer | Float)
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2
|
@@ -148,6 +148,8 @@ extra_rdoc_files:
|
|
148
148
|
- doc/release_notes/1_3_1.md
|
149
149
|
- doc/release_notes/1_3_2.md
|
150
150
|
- doc/release_notes/1_3_3.md
|
151
|
+
- doc/release_notes/1_3_4.md
|
152
|
+
- doc/release_notes/1_4_0.md
|
151
153
|
files:
|
152
154
|
- LICENSE.txt
|
153
155
|
- README.md
|
@@ -267,6 +269,8 @@ files:
|
|
267
269
|
- doc/release_notes/1_3_1.md
|
268
270
|
- doc/release_notes/1_3_2.md
|
269
271
|
- doc/release_notes/1_3_3.md
|
272
|
+
- doc/release_notes/1_3_4.md
|
273
|
+
- doc/release_notes/1_4_0.md
|
270
274
|
- lib/httpx.rb
|
271
275
|
- lib/httpx/adapters/datadog.rb
|
272
276
|
- lib/httpx/adapters/faraday.rb
|
@@ -305,6 +309,7 @@ files:
|
|
305
309
|
- lib/httpx/plugins/circuit_breaker.rb
|
306
310
|
- lib/httpx/plugins/circuit_breaker/circuit.rb
|
307
311
|
- lib/httpx/plugins/circuit_breaker/circuit_store.rb
|
312
|
+
- lib/httpx/plugins/content_digest.rb
|
308
313
|
- lib/httpx/plugins/cookies.rb
|
309
314
|
- lib/httpx/plugins/cookies/cookie.rb
|
310
315
|
- lib/httpx/plugins/cookies/jar.rb
|
@@ -337,6 +342,7 @@ files:
|
|
337
342
|
- lib/httpx/plugins/upgrade.rb
|
338
343
|
- lib/httpx/plugins/upgrade/h2.rb
|
339
344
|
- lib/httpx/plugins/webdav.rb
|
345
|
+
- lib/httpx/plugins/xml.rb
|
340
346
|
- lib/httpx/pmatch_extensions.rb
|
341
347
|
- lib/httpx/pool.rb
|
342
348
|
- lib/httpx/punycode.rb
|
@@ -371,7 +377,6 @@ files:
|
|
371
377
|
- lib/httpx/transcoder/utils/body_reader.rb
|
372
378
|
- lib/httpx/transcoder/utils/deflater.rb
|
373
379
|
- lib/httpx/transcoder/utils/inflater.rb
|
374
|
-
- lib/httpx/transcoder/xml.rb
|
375
380
|
- lib/httpx/utils.rb
|
376
381
|
- lib/httpx/version.rb
|
377
382
|
- sig/altsvc.rbs
|
@@ -405,6 +410,7 @@ files:
|
|
405
410
|
- sig/plugins/callbacks.rbs
|
406
411
|
- sig/plugins/circuit_breaker.rbs
|
407
412
|
- sig/plugins/compression.rbs
|
413
|
+
- sig/plugins/content_digest.rbs
|
408
414
|
- sig/plugins/cookies.rbs
|
409
415
|
- sig/plugins/cookies/cookie.rbs
|
410
416
|
- sig/plugins/cookies/jar.rbs
|
@@ -428,8 +434,11 @@ files:
|
|
428
434
|
- sig/plugins/rate_limiter.rbs
|
429
435
|
- sig/plugins/response_cache.rbs
|
430
436
|
- sig/plugins/retries.rbs
|
437
|
+
- sig/plugins/ssrf_filter.rbs
|
431
438
|
- sig/plugins/stream.rbs
|
432
439
|
- sig/plugins/upgrade.rbs
|
440
|
+
- sig/plugins/webdav.rbs
|
441
|
+
- sig/plugins/xml.rbs
|
433
442
|
- sig/pool.rbs
|
434
443
|
- sig/request.rbs
|
435
444
|
- sig/request/body.rbs
|
@@ -456,7 +465,6 @@ files:
|
|
456
465
|
- sig/transcoder/utils/body_reader.rbs
|
457
466
|
- sig/transcoder/utils/deflater.rbs
|
458
467
|
- sig/transcoder/utils/inflater.rbs
|
459
|
-
- sig/transcoder/xml.rbs
|
460
468
|
- sig/utils.rbs
|
461
469
|
homepage: https://gitlab.com/os85/httpx
|
462
470
|
licenses:
|
data/lib/httpx/transcoder/xml.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "delegate"
|
4
|
-
require "forwardable"
|
5
|
-
require "uri"
|
6
|
-
|
7
|
-
module HTTPX::Transcoder
|
8
|
-
module Xml
|
9
|
-
module_function
|
10
|
-
|
11
|
-
MIME_TYPES = %r{\b(application|text)/(.+\+)?xml\b}.freeze
|
12
|
-
|
13
|
-
class Encoder
|
14
|
-
def initialize(xml)
|
15
|
-
@raw = xml
|
16
|
-
end
|
17
|
-
|
18
|
-
def content_type
|
19
|
-
charset = @raw.respond_to?(:encoding) ? @raw.encoding.to_s.downcase : "utf-8"
|
20
|
-
"application/xml; charset=#{charset}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def bytesize
|
24
|
-
@raw.to_s.bytesize
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_s
|
28
|
-
@raw.to_s
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def encode(xml)
|
33
|
-
Encoder.new(xml)
|
34
|
-
end
|
35
|
-
|
36
|
-
begin
|
37
|
-
require "nokogiri"
|
38
|
-
|
39
|
-
def decode(response)
|
40
|
-
content_type = response.content_type.mime_type
|
41
|
-
|
42
|
-
raise HTTPX::Error, "invalid form mime type (#{content_type})" unless MIME_TYPES.match?(content_type)
|
43
|
-
|
44
|
-
Nokogiri::XML.method(:parse)
|
45
|
-
end
|
46
|
-
rescue LoadError
|
47
|
-
def decode(_response)
|
48
|
-
raise HTTPX::Error, "\"nokogiri\" is required in order to decode XML"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
data/sig/transcoder/xml.rbs
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module HTTPX::Transcoder
|
2
|
-
module Xml
|
3
|
-
MIME_TYPES: Regexp
|
4
|
-
|
5
|
-
def self?.encode: (untyped xml) -> Encoder
|
6
|
-
def self?.decode: (HTTPX::Response response) -> _Decoder
|
7
|
-
|
8
|
-
class Encoder
|
9
|
-
@raw: untyped # can be nokogiri object
|
10
|
-
|
11
|
-
def content_type: () -> String
|
12
|
-
|
13
|
-
def bytesize: () -> (Integer | Float)
|
14
|
-
|
15
|
-
def to_s: () -> String
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def initialize: (String xml) -> void
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|