wreq 1.2.4-aarch64-linux → 1.2.6-aarch64-linux
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/crates/wreq-util/.github/FUNDING.yml +15 -0
- data/crates/wreq-util/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/crates/wreq-util/.github/ISSUE_TEMPLATE/custom.md +10 -0
- data/crates/wreq-util/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/crates/wreq-util/.github/dependabot.yml +22 -0
- data/crates/wreq-util/.github/workflows/ci.yml +82 -0
- data/crates/wreq-util/.github/workflows/release-plz.yml +52 -0
- data/crates/wreq-util/.gitignore +24 -0
- data/crates/wreq-util/CHANGELOG.md +74 -0
- data/crates/wreq-util/LICENSE +201 -0
- data/crates/wreq-util/README.md +62 -0
- data/crates/wreq-util/release-plz.toml +2 -0
- data/crates/wreq-util/rustfmt.toml +5 -0
- data/examples/emulate_request.rb +1 -1
- data/lib/wreq.rb +72 -45
- data/lib/wreq_ruby/3.3/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/3.4/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/4.0/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/body.rb +30 -9
- data/lib/wreq_ruby/client.rb +88 -55
- data/lib/wreq_ruby/cookie.rb +81 -21
- data/lib/wreq_ruby/emulate.rb +77 -7
- data/lib/wreq_ruby/error.rb +5 -7
- data/lib/wreq_ruby/header.rb +205 -114
- data/lib/wreq_ruby/http.rb +74 -0
- data/lib/wreq_ruby/response.rb +31 -3
- data/script/build_windows_gnu.ps1 +6 -0
- data/test/body_sender_test.rb +246 -0
- data/test/cookie_test.rb +211 -10
- data/test/header_test.rb +228 -192
- data/test/json_precision_test.rb +209 -0
- data/test/option_validation_test.rb +311 -0
- data/test/stream_test.rb +36 -0
- data/test/value_semantics_test.rb +238 -0
- metadata +19 -2
data/lib/wreq.rb
CHANGED
|
@@ -9,6 +9,7 @@ end
|
|
|
9
9
|
|
|
10
10
|
# Load type hint definitions
|
|
11
11
|
require_relative "wreq_ruby/http"
|
|
12
|
+
require_relative "wreq_ruby/emulate"
|
|
12
13
|
require_relative "wreq_ruby/client"
|
|
13
14
|
require_relative "wreq_ruby/response"
|
|
14
15
|
require_relative "wreq_ruby/body"
|
|
@@ -18,22 +19,30 @@ require_relative "wreq_ruby/cookie"
|
|
|
18
19
|
|
|
19
20
|
unless defined?(Wreq)
|
|
20
21
|
module Wreq
|
|
22
|
+
# Current wreq gem version.
|
|
23
|
+
# @return [String]
|
|
21
24
|
VERSION = nil
|
|
22
25
|
|
|
26
|
+
# Module request methods accept only the options documented for each
|
|
27
|
+
# method. Unknown, ambiguous, ineffective, and unavailable platform options
|
|
28
|
+
# raise ArgumentError. Known values retain the error class from their Ruby
|
|
29
|
+
# or native conversion, such as TypeError or Wreq::BuilderError. Validation
|
|
30
|
+
# finishes before network I/O.
|
|
31
|
+
|
|
23
32
|
# Send an HTTP request.
|
|
24
33
|
#
|
|
25
34
|
# @param method [Wreq::Method] HTTP method to use
|
|
26
35
|
# @param url [String] Target URL
|
|
27
36
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
28
37
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
29
|
-
# @param default_headers [
|
|
38
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
30
39
|
# @param query [Hash, nil] URL query parameters
|
|
31
40
|
# @param auth [String, nil] Authorization header value
|
|
32
41
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
33
42
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
34
43
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
35
44
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
36
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
45
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
37
46
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
38
47
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
39
48
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -42,13 +51,15 @@ unless defined?(Wreq)
|
|
|
42
51
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
43
52
|
# @param proxy [String, nil] Proxy server URI
|
|
44
53
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
45
|
-
# @param interface [String, nil] Bind
|
|
54
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
46
55
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
47
56
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
48
57
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
49
|
-
# @param json [Object, nil] JSON body
|
|
50
|
-
# @param body [String,
|
|
58
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
59
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
51
60
|
# @return [Wreq::Response] HTTP response
|
|
61
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
62
|
+
# value cannot be converted, validated, or built
|
|
52
63
|
def self.request(method, url, **options)
|
|
53
64
|
end
|
|
54
65
|
|
|
@@ -57,14 +68,14 @@ unless defined?(Wreq)
|
|
|
57
68
|
# @param url [String] Target URL
|
|
58
69
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
59
70
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
60
|
-
# @param default_headers [
|
|
71
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
61
72
|
# @param query [Hash, nil] URL query parameters
|
|
62
73
|
# @param auth [String, nil] Authorization header value
|
|
63
74
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
64
75
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
65
76
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
66
77
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
67
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
78
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
68
79
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
69
80
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
70
81
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -73,13 +84,15 @@ unless defined?(Wreq)
|
|
|
73
84
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
74
85
|
# @param proxy [String, nil] Proxy server URI
|
|
75
86
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
76
|
-
# @param interface [String, nil] Bind
|
|
87
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
77
88
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
78
89
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
79
90
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
80
|
-
# @param json [Object, nil] JSON body
|
|
81
|
-
# @param body [String,
|
|
91
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
92
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
82
93
|
# @return [Wreq::Response] HTTP response
|
|
94
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
95
|
+
# value cannot be converted, validated, or built
|
|
83
96
|
def self.get(url, **options)
|
|
84
97
|
end
|
|
85
98
|
|
|
@@ -88,14 +101,14 @@ unless defined?(Wreq)
|
|
|
88
101
|
# @param url [String] Target URL
|
|
89
102
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
90
103
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
91
|
-
# @param default_headers [
|
|
104
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
92
105
|
# @param query [Hash, nil] URL query parameters
|
|
93
106
|
# @param auth [String, nil] Authorization header value
|
|
94
107
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
95
108
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
96
109
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
97
110
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
98
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
111
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
99
112
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
100
113
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
101
114
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -104,13 +117,15 @@ unless defined?(Wreq)
|
|
|
104
117
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
105
118
|
# @param proxy [String, nil] Proxy server URI
|
|
106
119
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
107
|
-
# @param interface [String, nil] Bind
|
|
120
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
108
121
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
109
122
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
110
123
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
111
|
-
# @param json [Object, nil] JSON body
|
|
112
|
-
# @param body [String,
|
|
124
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
125
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
113
126
|
# @return [Wreq::Response] HTTP response
|
|
127
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
128
|
+
# value cannot be converted, validated, or built
|
|
114
129
|
def self.head(url, **options)
|
|
115
130
|
end
|
|
116
131
|
|
|
@@ -119,14 +134,14 @@ unless defined?(Wreq)
|
|
|
119
134
|
# @param url [String] Target URL
|
|
120
135
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
121
136
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
122
|
-
# @param default_headers [
|
|
137
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
123
138
|
# @param query [Hash, nil] URL query parameters
|
|
124
139
|
# @param auth [String, nil] Authorization header value
|
|
125
140
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
126
141
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
127
142
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
128
143
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
129
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
144
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
130
145
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
131
146
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
132
147
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -135,13 +150,15 @@ unless defined?(Wreq)
|
|
|
135
150
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
136
151
|
# @param proxy [String, nil] Proxy server URI
|
|
137
152
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
138
|
-
# @param interface [String, nil] Bind
|
|
153
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
139
154
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
140
155
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
141
156
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
142
|
-
# @param json [Object, nil] JSON body
|
|
143
|
-
# @param body [String,
|
|
157
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
158
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
144
159
|
# @return [Wreq::Response] HTTP response
|
|
160
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
161
|
+
# value cannot be converted, validated, or built
|
|
145
162
|
def self.post(url, **options)
|
|
146
163
|
end
|
|
147
164
|
|
|
@@ -150,14 +167,14 @@ unless defined?(Wreq)
|
|
|
150
167
|
# @param url [String] Target URL
|
|
151
168
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
152
169
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
153
|
-
# @param default_headers [
|
|
170
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
154
171
|
# @param query [Hash, nil] URL query parameters
|
|
155
172
|
# @param auth [String, nil] Authorization header value
|
|
156
173
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
157
174
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
158
175
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
159
176
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
160
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
177
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
161
178
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
162
179
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
163
180
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -166,13 +183,15 @@ unless defined?(Wreq)
|
|
|
166
183
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
167
184
|
# @param proxy [String, nil] Proxy server URI
|
|
168
185
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
169
|
-
# @param interface [String, nil] Bind
|
|
186
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
170
187
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
171
188
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
172
189
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
173
|
-
# @param json [Object, nil] JSON body
|
|
174
|
-
# @param body [String,
|
|
190
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
191
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
175
192
|
# @return [Wreq::Response] HTTP response
|
|
193
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
194
|
+
# value cannot be converted, validated, or built
|
|
176
195
|
def self.put(url, **options)
|
|
177
196
|
end
|
|
178
197
|
|
|
@@ -181,14 +200,14 @@ unless defined?(Wreq)
|
|
|
181
200
|
# @param url [String] Target URL
|
|
182
201
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
183
202
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
184
|
-
# @param default_headers [
|
|
203
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
185
204
|
# @param query [Hash, nil] URL query parameters
|
|
186
205
|
# @param auth [String, nil] Authorization header value
|
|
187
206
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
188
207
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
189
208
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
190
209
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
191
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
210
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
192
211
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
193
212
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
194
213
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -197,13 +216,15 @@ unless defined?(Wreq)
|
|
|
197
216
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
198
217
|
# @param proxy [String, nil] Proxy server URI
|
|
199
218
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
200
|
-
# @param interface [String, nil] Bind
|
|
219
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
201
220
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
202
221
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
203
222
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
204
|
-
# @param json [Object, nil] JSON body
|
|
205
|
-
# @param body [String,
|
|
223
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
224
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
206
225
|
# @return [Wreq::Response] HTTP response
|
|
226
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
227
|
+
# value cannot be converted, validated, or built
|
|
207
228
|
def self.delete(url, **options)
|
|
208
229
|
end
|
|
209
230
|
|
|
@@ -212,14 +233,14 @@ unless defined?(Wreq)
|
|
|
212
233
|
# @param url [String] Target URL
|
|
213
234
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
214
235
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
215
|
-
# @param default_headers [
|
|
236
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
216
237
|
# @param query [Hash, nil] URL query parameters
|
|
217
238
|
# @param auth [String, nil] Authorization header value
|
|
218
239
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
219
240
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
220
241
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
221
242
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
222
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
243
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
223
244
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
224
245
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
225
246
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -228,13 +249,15 @@ unless defined?(Wreq)
|
|
|
228
249
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
229
250
|
# @param proxy [String, nil] Proxy server URI
|
|
230
251
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
231
|
-
# @param interface [String, nil] Bind
|
|
252
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
232
253
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
233
254
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
234
255
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
235
|
-
# @param json [Object, nil] JSON body
|
|
236
|
-
# @param body [String,
|
|
256
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
257
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
237
258
|
# @return [Wreq::Response] HTTP response
|
|
259
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
260
|
+
# value cannot be converted, validated, or built
|
|
238
261
|
def self.options(url, **options)
|
|
239
262
|
end
|
|
240
263
|
|
|
@@ -243,14 +266,14 @@ unless defined?(Wreq)
|
|
|
243
266
|
# @param url [String] Target URL
|
|
244
267
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
245
268
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
246
|
-
# @param default_headers [
|
|
269
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
247
270
|
# @param query [Hash, nil] URL query parameters
|
|
248
271
|
# @param auth [String, nil] Authorization header value
|
|
249
272
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
250
273
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
251
274
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
252
275
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
253
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
276
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
254
277
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
255
278
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
256
279
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -259,13 +282,15 @@ unless defined?(Wreq)
|
|
|
259
282
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
260
283
|
# @param proxy [String, nil] Proxy server URI
|
|
261
284
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
262
|
-
# @param interface [String, nil] Bind
|
|
285
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
263
286
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
264
287
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
265
288
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
266
|
-
# @param json [Object, nil] JSON body
|
|
267
|
-
# @param body [String,
|
|
289
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
290
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
268
291
|
# @return [Wreq::Response] HTTP response
|
|
292
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
293
|
+
# value cannot be converted, validated, or built
|
|
269
294
|
def self.trace(url, **options)
|
|
270
295
|
end
|
|
271
296
|
|
|
@@ -274,14 +299,14 @@ unless defined?(Wreq)
|
|
|
274
299
|
# @param url [String] Target URL
|
|
275
300
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
276
301
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
277
|
-
# @param default_headers [
|
|
302
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
278
303
|
# @param query [Hash, nil] URL query parameters
|
|
279
304
|
# @param auth [String, nil] Authorization header value
|
|
280
305
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
281
306
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
282
307
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
283
308
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
284
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
309
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
285
310
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
286
311
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
287
312
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -290,13 +315,15 @@ unless defined?(Wreq)
|
|
|
290
315
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
291
316
|
# @param proxy [String, nil] Proxy server URI
|
|
292
317
|
# @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
|
|
293
|
-
# @param interface [String, nil] Bind
|
|
318
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
294
319
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
295
320
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
296
321
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
297
|
-
# @param json [Object, nil] JSON body
|
|
298
|
-
# @param body [String,
|
|
322
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
323
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
299
324
|
# @return [Wreq::Response] HTTP response
|
|
325
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
326
|
+
# value cannot be converted, validated, or built
|
|
300
327
|
def self.patch(url, **options)
|
|
301
328
|
end
|
|
302
329
|
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/wreq_ruby/body.rb
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
unless defined?(Wreq)
|
|
4
4
|
module Wreq
|
|
5
|
-
#
|
|
6
|
-
# Backed by a Rust channel, avoids buffering the entire payload in memory.
|
|
5
|
+
# Streams a request body through a bounded, thread-safe channel.
|
|
7
6
|
#
|
|
8
|
-
#
|
|
7
|
+
# The channel applies backpressure instead of buffering the entire request body.
|
|
8
|
+
# Multiple threads may safely push chunks while a request drains the receiving side.
|
|
9
9
|
#
|
|
10
10
|
# Usage:
|
|
11
11
|
# sender = Wreq::BodySender.new(8)
|
|
@@ -15,22 +15,43 @@ unless defined?(Wreq)
|
|
|
15
15
|
# end
|
|
16
16
|
# resp = client.post(url, body: sender)
|
|
17
17
|
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
# - Each BodySender instance can only be used once (single-use):
|
|
21
|
-
# after being consumed by a request, further push or reuse is not allowed.
|
|
18
|
+
# A sender can be attached to one request. Closing it prevents further writes but
|
|
19
|
+
# retains queued chunks so a request attached afterward can still drain them.
|
|
22
20
|
class BodySender
|
|
23
|
-
#
|
|
21
|
+
# Create a bounded request-body sender.
|
|
22
|
+
#
|
|
23
|
+
# @param capacity [Integer] positive number of chunks that may wait in the channel;
|
|
24
|
+
# defaults to 8 and must be greater than zero
|
|
25
|
+
# @return [Wreq::BodySender] A streaming request body sender
|
|
26
|
+
# @raise [ArgumentError] if capacity is zero, negative, or too large
|
|
27
|
+
# @raise [TypeError] if capacity is not an Integer
|
|
24
28
|
def self.new(capacity = 8)
|
|
25
29
|
end
|
|
26
30
|
|
|
31
|
+
# Push one binary chunk, waiting while the channel is full.
|
|
32
|
+
#
|
|
27
33
|
# @param data [String] binary chunk
|
|
34
|
+
# @return [nil]
|
|
35
|
+
# @raise [IOError] if the sender or receiving side is closed
|
|
28
36
|
def push(data)
|
|
29
37
|
end
|
|
30
38
|
|
|
31
|
-
# Close the
|
|
39
|
+
# Close the producer and signal EOF after all queued chunks are read.
|
|
40
|
+
#
|
|
41
|
+
# This operation is idempotent.
|
|
42
|
+
#
|
|
43
|
+
# @return [nil]
|
|
32
44
|
def close
|
|
33
45
|
end
|
|
46
|
+
|
|
47
|
+
# Return whether the sender can no longer accept chunks.
|
|
48
|
+
#
|
|
49
|
+
# This becomes true after {#close} or when the request stops consuming
|
|
50
|
+
# the receiving side.
|
|
51
|
+
#
|
|
52
|
+
# @return [Boolean]
|
|
53
|
+
def closed?
|
|
54
|
+
end
|
|
34
55
|
end
|
|
35
56
|
end
|
|
36
57
|
end
|