httpx 1.3.4 → 1.4.1
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_4_0.md +43 -0
- data/doc/release_notes/1_4_1.md +19 -0
- data/lib/httpx/adapters/datadog.rb +55 -83
- data/lib/httpx/adapters/faraday.rb +2 -0
- data/lib/httpx/adapters/webmock.rb +18 -6
- data/lib/httpx/callbacks.rb +0 -5
- data/lib/httpx/chainable.rb +3 -1
- data/lib/httpx/connection/http2.rb +12 -8
- data/lib/httpx/connection.rb +192 -22
- 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/grpc/grpc_encoding.rb +2 -0
- 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 +25 -26
- data/lib/httpx/request.rb +7 -1
- data/lib/httpx/resolver/https.rb +15 -20
- data/lib/httpx/resolver/multi.rb +34 -16
- data/lib/httpx/resolver/native.rb +66 -25
- data/lib/httpx/resolver/resolver.rb +59 -15
- data/lib/httpx/resolver/system.rb +31 -15
- data/lib/httpx/resolver.rb +21 -14
- data/lib/httpx/response.rb +5 -3
- data/lib/httpx/selector.rb +160 -95
- data/lib/httpx/session.rb +273 -140
- data/lib/httpx/transcoder/body.rb +15 -31
- data/lib/httpx/transcoder/gzip.rb +0 -3
- data/lib/httpx/transcoder/json.rb +14 -2
- data/lib/httpx/transcoder/multipart/part.rb +1 -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 +20 -21
- data/sig/callbacks.rbs +0 -1
- data/sig/chainable.rbs +4 -0
- data/sig/connection/http2.rbs +1 -1
- data/sig/connection.rbs +29 -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 -9
- data/sig/resolver/multi.rbs +26 -1
- data/sig/resolver/native.rbs +2 -2
- data/sig/resolver/resolver.rbs +21 -2
- data/sig/resolver.rbs +5 -1
- data/sig/response/buffer.rbs +1 -1
- data/sig/selector.rbs +30 -4
- data/sig/session.rbs +47 -18
- data/sig/transcoder/body.rbs +2 -4
- 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/utils/body_reader.rbs +3 -3
- data/sig/transcoder/utils/deflater.rbs +3 -3
- metadata +12 -4
- data/lib/httpx/transcoder/xml.rb +0 -52
- data/sig/transcoder/xml.rbs +0 -22
data/sig/request/body.rbs
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module HTTPX
|
2
2
|
class Request::Body
|
3
|
+
attr_reader options: Options
|
4
|
+
|
3
5
|
@headers: Headers
|
4
6
|
@body: body_encoder?
|
5
7
|
@unbounded_body: bool
|
6
8
|
|
7
|
-
def initialize: (Headers
|
9
|
+
def initialize: (Headers h, Options options, **untyped) -> void
|
8
10
|
|
9
11
|
def each: () { (String) -> void } -> void
|
10
12
|
| () -> Enumerable[String]
|
@@ -25,14 +27,8 @@ module HTTPX
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
|
-
def self.
|
29
|
-
end
|
30
|
-
|
31
|
-
class ProcIO
|
32
|
-
@block: ^(String) -> void
|
33
|
-
|
34
|
-
def initialize: (^(String) -> void) -> untyped
|
30
|
+
def self.initialize_body: (Hash[Symbol, untyped] params) -> body_encoder?
|
35
31
|
|
36
|
-
def
|
32
|
+
def self.initialize_deflater_body: (body_encoder body, Encoding | String encoding) -> body_encoder
|
37
33
|
end
|
38
34
|
end
|
data/sig/resolver/multi.rbs
CHANGED
@@ -1,7 +1,32 @@
|
|
1
1
|
module HTTPX
|
2
2
|
module Resolver
|
3
3
|
class Multi
|
4
|
-
|
4
|
+
attr_reader resolvers: Array[Native | HTTPS]
|
5
|
+
|
6
|
+
attr_reader options: Options
|
7
|
+
|
8
|
+
@current_selector: Selector?
|
9
|
+
@current_session: Session?
|
10
|
+
@resolver_options: Hash[Symbol, untyped]
|
11
|
+
# @errors: Hash[Symbol, untyped]
|
12
|
+
|
13
|
+
def current_selector=: (Selector s) -> void
|
14
|
+
|
15
|
+
def current_session=: (Session s) -> void
|
16
|
+
|
17
|
+
def closed?: () -> bool
|
18
|
+
|
19
|
+
def empty?: () -> bool
|
20
|
+
|
21
|
+
def timeout: () -> Numeric?
|
22
|
+
|
23
|
+
def close: () -> void
|
24
|
+
|
25
|
+
def connections: () -> Array[Connection]
|
26
|
+
|
27
|
+
def early_resolve: (Connection connection) -> bool
|
28
|
+
|
29
|
+
def lazy_resolve: (Connection connection) -> void
|
5
30
|
end
|
6
31
|
end
|
7
32
|
end
|
data/sig/resolver/native.rbs
CHANGED
@@ -7,8 +7,6 @@ module HTTPX
|
|
7
7
|
DEFAULTS: Hash[Symbol, untyped]
|
8
8
|
DNS_PORT: Integer
|
9
9
|
|
10
|
-
attr_reader family: ip_family
|
11
|
-
|
12
10
|
@options: Options
|
13
11
|
@ns_index: Integer
|
14
12
|
@nameserver: Array[String]
|
@@ -66,6 +64,8 @@ module HTTPX
|
|
66
64
|
def handle_error: (NativeResolveError | StandardError) -> void
|
67
65
|
|
68
66
|
def reset_hostname: (String hostname, ?connection: Connection, ?reset_candidates: bool) -> void
|
67
|
+
|
68
|
+
def close_or_resolve: () -> void
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
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/buffer.rbs
CHANGED
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,52 @@ 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 pin_connection: (Resolver::Resolver | Connection connection, Selector selector) -> void
|
24
29
|
|
25
|
-
def
|
30
|
+
def deselect_connection: (Connection connection, Selector selector, ?bool cloned) -> void
|
26
31
|
|
27
|
-
def
|
32
|
+
def select_resolver: (Resolver::Native | Resolver::HTTPS resolver, Selector selector) -> void
|
28
33
|
|
29
|
-
def
|
34
|
+
def deselect_resolver: (Resolver::Resolver resolver, Selector selector) -> void
|
30
35
|
|
31
|
-
def
|
36
|
+
def try_clone_connection: (Connection connection, Selector selector, Integer? family) -> Connection
|
32
37
|
|
33
|
-
def find_connection: (
|
38
|
+
def find_connection: (http_uri request_uri, Selector selector, Options options) -> Connection
|
34
39
|
|
35
|
-
|
40
|
+
private
|
36
41
|
|
37
|
-
def
|
42
|
+
def initialize: (?options) { (self) -> void } -> void
|
43
|
+
| (?options) -> void
|
38
44
|
|
39
|
-
def
|
45
|
+
def deactivate: (Selector selector) -> void
|
40
46
|
|
41
|
-
def
|
47
|
+
def on_response: (Request, response) -> void
|
42
48
|
|
43
|
-
def
|
49
|
+
def on_promise: (untyped, untyped) -> void
|
50
|
+
|
51
|
+
def fetch_response: (Request request, Selector selector, Options options) -> response?
|
52
|
+
|
53
|
+
def send_request: (Request request, Selector selector, ?Options options) -> void
|
54
|
+
|
55
|
+
def set_request_callbacks: (Request request) -> void
|
44
56
|
|
45
57
|
def build_requests: (verb, uri, request_params) -> Array[Request]
|
46
58
|
| (Array[[verb, uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
|
@@ -48,13 +60,30 @@ module HTTPX
|
|
48
60
|
| (verb, _Each[[uri, request_params]], Hash[Symbol, untyped]) -> Array[Request]
|
49
61
|
| (verb, _Each[uri], request_params) -> Array[Request]
|
50
62
|
|
51
|
-
def
|
63
|
+
def do_init_connection: (Connection connection, Selector selector) -> void
|
52
64
|
|
53
65
|
def send_requests: (*Request) -> Array[response]
|
54
66
|
|
55
|
-
def _send_requests: (Array[Request] requests) ->
|
67
|
+
def _send_requests: (Array[Request] requests, Selector selector) -> void
|
68
|
+
|
69
|
+
def receive_requests: (Array[Request] requests, Selector selector) -> Array[response]
|
70
|
+
|
71
|
+
def resolve_connection: (Connection connection, Selector selector) -> void
|
72
|
+
|
73
|
+
def on_resolver_connection: (Connection connection, Selector selector) -> void
|
74
|
+
|
75
|
+
def on_resolver_close: (Resolver::Resolver resolver, Selector selector) -> void
|
76
|
+
|
77
|
+
def find_resolver_for: (Connection connection, Selector selector) -> (Resolver::Multi | Resolver::Resolver)
|
78
|
+
|
79
|
+
def coalesce_connections: (Connection conn1, Connection conn2, Selector selector, bool from_pool) -> bool
|
80
|
+
|
81
|
+
def get_current_selector: () -> Selector?
|
82
|
+
| () { () -> Selector } -> Selector
|
83
|
+
|
84
|
+
def set_current_selector: (Selector? selector) -> void
|
56
85
|
|
57
|
-
def
|
86
|
+
def selector_store: () -> Hash[instance, Selector]
|
58
87
|
|
59
88
|
attr_reader self.default_options: Options
|
60
89
|
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
|
@@ -1,13 +1,13 @@
|
|
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
|
|
10
|
-
def read: (?int? length, ?string outbuf) -> String?
|
10
|
+
def read: (?int? length, ?string? outbuf) -> String?
|
11
11
|
|
12
12
|
def close: () -> void
|
13
13
|
end
|
@@ -5,16 +5,16 @@ 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
|
|
17
|
-
def read: (?int? length, ?string outbuf) -> String?
|
17
|
+
def read: (?int? length, ?string? outbuf) -> String?
|
18
18
|
|
19
19
|
def close: () -> void
|
20
20
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2
|
@@ -149,6 +149,8 @@ extra_rdoc_files:
|
|
149
149
|
- doc/release_notes/1_3_2.md
|
150
150
|
- doc/release_notes/1_3_3.md
|
151
151
|
- doc/release_notes/1_3_4.md
|
152
|
+
- doc/release_notes/1_4_0.md
|
153
|
+
- doc/release_notes/1_4_1.md
|
152
154
|
files:
|
153
155
|
- LICENSE.txt
|
154
156
|
- README.md
|
@@ -269,6 +271,8 @@ files:
|
|
269
271
|
- doc/release_notes/1_3_2.md
|
270
272
|
- doc/release_notes/1_3_3.md
|
271
273
|
- doc/release_notes/1_3_4.md
|
274
|
+
- doc/release_notes/1_4_0.md
|
275
|
+
- doc/release_notes/1_4_1.md
|
272
276
|
- lib/httpx.rb
|
273
277
|
- lib/httpx/adapters/datadog.rb
|
274
278
|
- lib/httpx/adapters/faraday.rb
|
@@ -307,6 +311,7 @@ files:
|
|
307
311
|
- lib/httpx/plugins/circuit_breaker.rb
|
308
312
|
- lib/httpx/plugins/circuit_breaker/circuit.rb
|
309
313
|
- lib/httpx/plugins/circuit_breaker/circuit_store.rb
|
314
|
+
- lib/httpx/plugins/content_digest.rb
|
310
315
|
- lib/httpx/plugins/cookies.rb
|
311
316
|
- lib/httpx/plugins/cookies/cookie.rb
|
312
317
|
- lib/httpx/plugins/cookies/jar.rb
|
@@ -339,6 +344,7 @@ files:
|
|
339
344
|
- lib/httpx/plugins/upgrade.rb
|
340
345
|
- lib/httpx/plugins/upgrade/h2.rb
|
341
346
|
- lib/httpx/plugins/webdav.rb
|
347
|
+
- lib/httpx/plugins/xml.rb
|
342
348
|
- lib/httpx/pmatch_extensions.rb
|
343
349
|
- lib/httpx/pool.rb
|
344
350
|
- lib/httpx/punycode.rb
|
@@ -373,7 +379,6 @@ files:
|
|
373
379
|
- lib/httpx/transcoder/utils/body_reader.rb
|
374
380
|
- lib/httpx/transcoder/utils/deflater.rb
|
375
381
|
- lib/httpx/transcoder/utils/inflater.rb
|
376
|
-
- lib/httpx/transcoder/xml.rb
|
377
382
|
- lib/httpx/utils.rb
|
378
383
|
- lib/httpx/version.rb
|
379
384
|
- sig/altsvc.rbs
|
@@ -407,6 +412,7 @@ files:
|
|
407
412
|
- sig/plugins/callbacks.rbs
|
408
413
|
- sig/plugins/circuit_breaker.rbs
|
409
414
|
- sig/plugins/compression.rbs
|
415
|
+
- sig/plugins/content_digest.rbs
|
410
416
|
- sig/plugins/cookies.rbs
|
411
417
|
- sig/plugins/cookies/cookie.rbs
|
412
418
|
- sig/plugins/cookies/jar.rbs
|
@@ -430,8 +436,11 @@ files:
|
|
430
436
|
- sig/plugins/rate_limiter.rbs
|
431
437
|
- sig/plugins/response_cache.rbs
|
432
438
|
- sig/plugins/retries.rbs
|
439
|
+
- sig/plugins/ssrf_filter.rbs
|
433
440
|
- sig/plugins/stream.rbs
|
434
441
|
- sig/plugins/upgrade.rbs
|
442
|
+
- sig/plugins/webdav.rbs
|
443
|
+
- sig/plugins/xml.rbs
|
435
444
|
- sig/pool.rbs
|
436
445
|
- sig/request.rbs
|
437
446
|
- sig/request/body.rbs
|
@@ -458,7 +467,6 @@ files:
|
|
458
467
|
- sig/transcoder/utils/body_reader.rbs
|
459
468
|
- sig/transcoder/utils/deflater.rbs
|
460
469
|
- sig/transcoder/utils/inflater.rbs
|
461
|
-
- sig/transcoder/xml.rbs
|
462
470
|
- sig/utils.rbs
|
463
471
|
homepage: https://gitlab.com/os85/httpx
|
464
472
|
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
|