wreq 1.2.4 → 1.2.6
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/Cargo.lock +22 -19
- data/Cargo.toml +15 -2
- 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/Cargo.toml +94 -0
- data/crates/wreq-util/LICENSE +201 -0
- data/crates/wreq-util/README.md +62 -0
- data/crates/wreq-util/examples/emulate.rs +39 -0
- data/crates/wreq-util/examples/tower_delay.rs +191 -0
- data/crates/wreq-util/release-plz.toml +2 -0
- data/crates/wreq-util/rustfmt.toml +5 -0
- data/crates/wreq-util/src/emulate/compress.rs +85 -0
- data/crates/wreq-util/src/emulate/macros.rs +372 -0
- data/crates/wreq-util/src/emulate/profile/chrome/header.rs +74 -0
- data/crates/wreq-util/src/emulate/profile/chrome/http2.rs +65 -0
- data/crates/wreq-util/src/emulate/profile/chrome/tls.rs +153 -0
- data/crates/wreq-util/src/emulate/profile/chrome.rs +2028 -0
- data/crates/wreq-util/src/emulate/profile/firefox/header.rs +37 -0
- data/crates/wreq-util/src/emulate/profile/firefox/http2.rs +113 -0
- data/crates/wreq-util/src/emulate/profile/firefox/tls.rs +253 -0
- data/crates/wreq-util/src/emulate/profile/firefox.rs +518 -0
- data/crates/wreq-util/src/emulate/profile/okhttp.rs +241 -0
- data/crates/wreq-util/src/emulate/profile/opera/header.rs +29 -0
- data/crates/wreq-util/src/emulate/profile/opera/http2.rs +50 -0
- data/crates/wreq-util/src/emulate/profile/opera/tls.rs +97 -0
- data/crates/wreq-util/src/emulate/profile/opera.rs +299 -0
- data/crates/wreq-util/src/emulate/profile/safari/header.rs +59 -0
- data/crates/wreq-util/src/emulate/profile/safari/http2.rs +116 -0
- data/crates/wreq-util/src/emulate/profile/safari/tls.rs +177 -0
- data/crates/wreq-util/src/emulate/profile/safari.rs +222 -0
- data/crates/wreq-util/src/emulate/profile.rs +47 -0
- data/crates/wreq-util/src/emulate.rs +369 -0
- data/crates/wreq-util/src/lib.rs +14 -0
- data/crates/wreq-util/src/rand.rs +24 -0
- data/crates/wreq-util/src/tower/delay/future.rs +43 -0
- data/crates/wreq-util/src/tower/delay/layer.rs +201 -0
- data/crates/wreq-util/src/tower/delay/service.rs +190 -0
- data/crates/wreq-util/src/tower/delay.rs +98 -0
- data/crates/wreq-util/src/tower.rs +7 -0
- data/crates/wreq-util/tests/client.rs +153 -0
- data/crates/wreq-util/tests/emulate_chrome.rs +270 -0
- data/crates/wreq-util/tests/emulate_firefox.rs +92 -0
- data/crates/wreq-util/tests/emulate_okhttp.rs +46 -0
- data/crates/wreq-util/tests/emulate_opera.rs +113 -0
- data/crates/wreq-util/tests/emulate_safari.rs +151 -0
- data/crates/wreq-util/tests/support/mod.rs +55 -0
- data/crates/wreq-util/tests/support/server.rs +232 -0
- data/examples/emulate_request.rb +1 -1
- data/lib/wreq.rb +72 -45
- 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/src/arch.rs +22 -0
- data/src/client/body/form.rs +2 -0
- data/src/client/body/json.rs +47 -14
- data/src/client/body/stream.rs +147 -43
- data/src/client/body.rs +11 -15
- data/src/client/param.rs +7 -7
- data/src/client/req.rs +87 -47
- data/src/client/resp.rs +23 -24
- data/src/client.rs +310 -230
- data/src/cookie.rs +280 -87
- data/src/emulate.rs +86 -50
- data/src/error.rs +198 -45
- data/src/extractor.rs +16 -76
- data/src/header.rs +318 -130
- data/src/http.rs +62 -33
- data/src/lib.rs +26 -20
- data/src/macros.rs +71 -46
- data/src/options.rs +284 -0
- data/src/rt.rs +22 -11
- data/src/serde/de/array_deserializer.rs +48 -0
- data/src/serde/de/array_enumerator.rs +59 -0
- data/src/serde/de/deserializer.rs +307 -0
- data/src/serde/de/enum_deserializer.rs +47 -0
- data/src/serde/de/hash_deserializer.rs +89 -0
- data/src/serde/de/number_deserializer.rs +51 -0
- data/src/serde/de/variant_deserializer.rs +101 -0
- data/src/serde/de.rs +33 -0
- data/src/serde/error.rs +146 -0
- data/src/serde/ser/enums.rs +14 -0
- data/src/serde/ser/map_serializer.rs +56 -0
- data/src/serde/ser/seq_serializer.rs +71 -0
- data/src/serde/ser/serializer.rs +194 -0
- data/src/serde/ser/struct_serializer.rs +106 -0
- data/src/serde/ser/struct_variant_serializer.rs +44 -0
- data/src/serde/ser/tuple_variant_serializer.rs +41 -0
- data/src/serde/ser.rs +18 -0
- data/src/serde/tests.rs +237 -0
- data/src/serde.rs +202 -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 +77 -1
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
|
data/lib/wreq_ruby/client.rb
CHANGED
|
@@ -11,6 +11,12 @@ unless defined?(Wreq)
|
|
|
11
11
|
# The client is thread-safe and maintains an internal connection pool for
|
|
12
12
|
# efficient request reuse.
|
|
13
13
|
#
|
|
14
|
+
# Client and request options are limited to the keys listed below. Unknown,
|
|
15
|
+
# ambiguous, ineffective, and unavailable platform options raise
|
|
16
|
+
# ArgumentError. Known values retain the error class from their Ruby or
|
|
17
|
+
# native conversion, such as TypeError or Wreq::BuilderError. Request
|
|
18
|
+
# validation finishes before network I/O.
|
|
19
|
+
#
|
|
14
20
|
# @example Basic usage
|
|
15
21
|
# client = Wreq::Client.new
|
|
16
22
|
# # Use client for HTTP requests
|
|
@@ -50,8 +56,7 @@ unless defined?(Wreq)
|
|
|
50
56
|
# will be returned directly to the caller.
|
|
51
57
|
#
|
|
52
58
|
# @param max_redirects [Integer, nil] Maximum number of redirects to
|
|
53
|
-
# follow before returning an error.
|
|
54
|
-
# is true. Default is typically 10 if not specified.
|
|
59
|
+
# follow before returning an error. Requires `allow_redirects: true`.
|
|
55
60
|
#
|
|
56
61
|
# @param cookie_store [Boolean, nil] Enable an in-memory cookie jar
|
|
57
62
|
# that automatically handles Set-Cookie headers and sends appropriate
|
|
@@ -85,7 +90,7 @@ unless defined?(Wreq)
|
|
|
85
90
|
#
|
|
86
91
|
# @param tcp_user_timeout [Integer, nil] Maximum time in seconds that
|
|
87
92
|
# transmitted data may remain unacknowledged before the connection is
|
|
88
|
-
# forcibly closed.
|
|
93
|
+
# forcibly closed. Available on Android, Fuchsia, and Linux only.
|
|
89
94
|
#
|
|
90
95
|
# @param tcp_nodelay [Boolean, nil] Enable TCP_NODELAY socket option,
|
|
91
96
|
# which disables Nagle's algorithm. When true, small packets are sent
|
|
@@ -133,7 +138,9 @@ unless defined?(Wreq)
|
|
|
133
138
|
# Supports HTTP, HTTPS, and SOCKS5 proxies. Format: "protocol://host:port"
|
|
134
139
|
# Example: "http://proxy.example.com:8080"
|
|
135
140
|
# @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.
|
|
136
|
-
# @param interface [String, nil] Bind
|
|
141
|
+
# @param interface [String, nil] Bind sockets to a network interface on
|
|
142
|
+
# platforms supported by the native client. Unsupported platforms raise
|
|
143
|
+
# ArgumentError.
|
|
137
144
|
#
|
|
138
145
|
# @param gzip [Boolean, nil] Accept and automatically decompress gzip
|
|
139
146
|
# content encoding. When true, adds "Accept-Encoding: gzip" header.
|
|
@@ -151,10 +158,13 @@ unless defined?(Wreq)
|
|
|
151
158
|
#
|
|
152
159
|
# @return [Wreq::Client] A configured HTTP client instance ready to make requests.
|
|
153
160
|
#
|
|
154
|
-
# @raise [ArgumentError] if
|
|
155
|
-
#
|
|
156
|
-
# @raise [
|
|
157
|
-
#
|
|
161
|
+
# @raise [ArgumentError] if an option is unknown, conflicting,
|
|
162
|
+
# ineffective, or unavailable on the current platform.
|
|
163
|
+
# @raise [TypeError] if the option argument is not a Hash.
|
|
164
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
165
|
+
# value cannot be converted or validated.
|
|
166
|
+
# @raise [Wreq::BuilderError, Wreq::TlsError] if the native client cannot
|
|
167
|
+
# be initialized.
|
|
158
168
|
#
|
|
159
169
|
# @example Minimal client
|
|
160
170
|
# client = Wreq::Client.new
|
|
@@ -179,8 +189,7 @@ unless defined?(Wreq)
|
|
|
179
189
|
# client = Wreq::Client.new(
|
|
180
190
|
# allow_redirects: true,
|
|
181
191
|
# max_redirects: 5,
|
|
182
|
-
# referer: true
|
|
183
|
-
# history: true
|
|
192
|
+
# referer: true
|
|
184
193
|
# )
|
|
185
194
|
#
|
|
186
195
|
# @example Client with compression
|
|
@@ -236,18 +245,22 @@ unless defined?(Wreq)
|
|
|
236
245
|
|
|
237
246
|
# Send an HTTP request.
|
|
238
247
|
#
|
|
248
|
+
# Only the options listed here are accepted. Body options (`body`, `form`,
|
|
249
|
+
# `json`) and authentication options (`auth`, `bearer_auth`, `basic_auth`)
|
|
250
|
+
# are mutually exclusive. `max_redirects` requires `allow_redirects: true`.
|
|
251
|
+
#
|
|
239
252
|
# @param method [Wreq::Method] HTTP method to use
|
|
240
253
|
# @param url [String] Target URL
|
|
241
254
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
242
255
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
243
|
-
# @param default_headers [
|
|
256
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
244
257
|
# @param query [Hash, nil] URL query parameters
|
|
245
258
|
# @param auth [String, nil] Authorization header value
|
|
246
259
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
247
260
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
248
261
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
249
262
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
250
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
263
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
251
264
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
252
265
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
253
266
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -256,13 +269,17 @@ unless defined?(Wreq)
|
|
|
256
269
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
257
270
|
# @param proxy [String, nil] Proxy server URI
|
|
258
271
|
# @param local_address [String, nil] Bind the request'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.
|
|
259
|
-
# @param interface [String, nil] Bind
|
|
272
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
260
273
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
261
274
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
262
275
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
263
|
-
# @param json [Object, nil] JSON body
|
|
264
|
-
# @param body [String,
|
|
276
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
277
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
265
278
|
# @return [Wreq::Response] HTTP response
|
|
279
|
+
# @raise [ArgumentError] if options are unknown, conflicting, ineffective,
|
|
280
|
+
# or unavailable on the current platform
|
|
281
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
282
|
+
# value cannot be converted, validated, or built
|
|
266
283
|
def request(method, url, **options)
|
|
267
284
|
end
|
|
268
285
|
|
|
@@ -271,14 +288,14 @@ unless defined?(Wreq)
|
|
|
271
288
|
# @param url [String] Target URL
|
|
272
289
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
273
290
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
274
|
-
# @param default_headers [
|
|
291
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
275
292
|
# @param query [Hash, nil] URL query parameters
|
|
276
293
|
# @param auth [String, nil] Authorization header value
|
|
277
294
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
278
295
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
279
296
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
280
297
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
281
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
298
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
282
299
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
283
300
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
284
301
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -287,13 +304,15 @@ unless defined?(Wreq)
|
|
|
287
304
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
288
305
|
# @param proxy [String, nil] Proxy server URI
|
|
289
306
|
# @param local_address [String, nil] Bind the request'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.
|
|
290
|
-
# @param interface [String, nil] Bind
|
|
307
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
291
308
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
292
309
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
293
310
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
294
|
-
# @param json [Object, nil] JSON body
|
|
295
|
-
# @param body [String,
|
|
311
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
312
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
296
313
|
# @return [Wreq::Response] HTTP response
|
|
314
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
315
|
+
# value cannot be converted, validated, or built
|
|
297
316
|
def get(url, **options)
|
|
298
317
|
end
|
|
299
318
|
|
|
@@ -302,14 +321,14 @@ unless defined?(Wreq)
|
|
|
302
321
|
# @param url [String] Target URL
|
|
303
322
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
304
323
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
305
|
-
# @param default_headers [
|
|
324
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
306
325
|
# @param query [Hash, nil] URL query parameters
|
|
307
326
|
# @param auth [String, nil] Authorization header value
|
|
308
327
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
309
328
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
310
329
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
311
330
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
312
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
331
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
313
332
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
314
333
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
315
334
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -318,13 +337,15 @@ unless defined?(Wreq)
|
|
|
318
337
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
319
338
|
# @param proxy [String, nil] Proxy server URI
|
|
320
339
|
# @param local_address [String, nil] Bind the request'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.
|
|
321
|
-
# @param interface [String, nil] Bind
|
|
340
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
322
341
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
323
342
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
324
343
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
325
|
-
# @param json [Object, nil] JSON body
|
|
326
|
-
# @param body [String,
|
|
344
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
345
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
327
346
|
# @return [Wreq::Response] HTTP response
|
|
347
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
348
|
+
# value cannot be converted, validated, or built
|
|
328
349
|
def head(url, **options)
|
|
329
350
|
end
|
|
330
351
|
|
|
@@ -333,14 +354,14 @@ unless defined?(Wreq)
|
|
|
333
354
|
# @param url [String] Target URL
|
|
334
355
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
335
356
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
336
|
-
# @param default_headers [
|
|
357
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
337
358
|
# @param query [Hash, nil] URL query parameters
|
|
338
359
|
# @param auth [String, nil] Authorization header value
|
|
339
360
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
340
361
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
341
362
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
342
363
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
343
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
364
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
344
365
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
345
366
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
346
367
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -349,13 +370,15 @@ unless defined?(Wreq)
|
|
|
349
370
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
350
371
|
# @param proxy [String, nil] Proxy server URI
|
|
351
372
|
# @param local_address [String, nil] Bind the request'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.
|
|
352
|
-
# @param interface [String, nil] Bind
|
|
373
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
353
374
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
354
375
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
355
376
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
356
|
-
# @param json [Object, nil] JSON body
|
|
357
|
-
# @param body [String,
|
|
377
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
378
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
358
379
|
# @return [Wreq::Response] HTTP response
|
|
380
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
381
|
+
# value cannot be converted, validated, or built
|
|
359
382
|
def post(url, **options)
|
|
360
383
|
end
|
|
361
384
|
|
|
@@ -364,14 +387,14 @@ unless defined?(Wreq)
|
|
|
364
387
|
# @param url [String] Target URL
|
|
365
388
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
366
389
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
367
|
-
# @param default_headers [
|
|
390
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
368
391
|
# @param query [Hash, nil] URL query parameters
|
|
369
392
|
# @param auth [String, nil] Authorization header value
|
|
370
393
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
371
394
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
372
395
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
373
396
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
374
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
397
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
375
398
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
376
399
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
377
400
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -380,13 +403,15 @@ unless defined?(Wreq)
|
|
|
380
403
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
381
404
|
# @param proxy [String, nil] Proxy server URI
|
|
382
405
|
# @param local_address [String, nil] Bind the request'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.
|
|
383
|
-
# @param interface [String, nil] Bind
|
|
406
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
384
407
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
385
408
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
386
409
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
387
|
-
# @param json [Object, nil] JSON body
|
|
388
|
-
# @param body [String,
|
|
410
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
411
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
389
412
|
# @return [Wreq::Response] HTTP response
|
|
413
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
414
|
+
# value cannot be converted, validated, or built
|
|
390
415
|
def put(url, **options)
|
|
391
416
|
end
|
|
392
417
|
|
|
@@ -395,14 +420,14 @@ unless defined?(Wreq)
|
|
|
395
420
|
# @param url [String] Target URL
|
|
396
421
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
397
422
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
398
|
-
# @param default_headers [
|
|
423
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
399
424
|
# @param query [Hash, nil] URL query parameters
|
|
400
425
|
# @param auth [String, nil] Authorization header value
|
|
401
426
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
402
427
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
403
428
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
404
429
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
405
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
430
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
406
431
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
407
432
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
408
433
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -411,13 +436,15 @@ unless defined?(Wreq)
|
|
|
411
436
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
412
437
|
# @param proxy [String, nil] Proxy server URI
|
|
413
438
|
# @param local_address [String, nil] Bind the request'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.
|
|
414
|
-
# @param interface [String, nil] Bind
|
|
439
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
415
440
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
416
441
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
417
442
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
418
|
-
# @param json [Object, nil] JSON body
|
|
419
|
-
# @param body [String,
|
|
443
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
444
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
420
445
|
# @return [Wreq::Response] HTTP response
|
|
446
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
447
|
+
# value cannot be converted, validated, or built
|
|
421
448
|
def delete(url, **options)
|
|
422
449
|
end
|
|
423
450
|
|
|
@@ -426,14 +453,14 @@ unless defined?(Wreq)
|
|
|
426
453
|
# @param url [String] Target URL
|
|
427
454
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
428
455
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
429
|
-
# @param default_headers [
|
|
456
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
430
457
|
# @param query [Hash, nil] URL query parameters
|
|
431
458
|
# @param auth [String, nil] Authorization header value
|
|
432
459
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
433
460
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
434
461
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
435
462
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
436
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
463
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
437
464
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
438
465
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
439
466
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -442,13 +469,15 @@ unless defined?(Wreq)
|
|
|
442
469
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
443
470
|
# @param proxy [String, nil] Proxy server URI
|
|
444
471
|
# @param local_address [String, nil] Bind the request'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.
|
|
445
|
-
# @param interface [String, nil] Bind
|
|
472
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
446
473
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
447
474
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
448
475
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
449
|
-
# @param json [Object, nil] JSON body
|
|
450
|
-
# @param body [String,
|
|
476
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
477
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
451
478
|
# @return [Wreq::Response] HTTP response
|
|
479
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
480
|
+
# value cannot be converted, validated, or built
|
|
452
481
|
def options(url, **options)
|
|
453
482
|
end
|
|
454
483
|
|
|
@@ -457,14 +486,14 @@ unless defined?(Wreq)
|
|
|
457
486
|
# @param url [String] Target URL
|
|
458
487
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
459
488
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
460
|
-
# @param default_headers [
|
|
489
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
461
490
|
# @param query [Hash, nil] URL query parameters
|
|
462
491
|
# @param auth [String, nil] Authorization header value
|
|
463
492
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
464
493
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
465
494
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
466
495
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
467
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
496
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
468
497
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
469
498
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
470
499
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -473,13 +502,15 @@ unless defined?(Wreq)
|
|
|
473
502
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
474
503
|
# @param proxy [String, nil] Proxy server URI
|
|
475
504
|
# @param local_address [String, nil] Bind the request'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.
|
|
476
|
-
# @param interface [String, nil] Bind
|
|
505
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
477
506
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
478
507
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
479
508
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
480
|
-
# @param json [Object, nil] JSON body
|
|
481
|
-
# @param body [String,
|
|
509
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
510
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
482
511
|
# @return [Wreq::Response] HTTP response
|
|
512
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
513
|
+
# value cannot be converted, validated, or built
|
|
483
514
|
def trace(url, **options)
|
|
484
515
|
end
|
|
485
516
|
|
|
@@ -488,14 +519,14 @@ unless defined?(Wreq)
|
|
|
488
519
|
# @param url [String] Target URL
|
|
489
520
|
# @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
|
|
490
521
|
# @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
|
|
491
|
-
# @param default_headers [
|
|
522
|
+
# @param default_headers [Boolean, nil] Whether to apply native default headers
|
|
492
523
|
# @param query [Hash, nil] URL query parameters
|
|
493
524
|
# @param auth [String, nil] Authorization header value
|
|
494
525
|
# @param bearer_auth [String, nil] Bearer token for Authorization header
|
|
495
526
|
# @param basic_auth [Array<String>, nil] Username and password for basic auth
|
|
496
527
|
# @param cookies [Hash{String=>String}, String, nil] Cookies to send
|
|
497
528
|
# @param allow_redirects [Boolean, nil] Whether to follow redirects
|
|
498
|
-
# @param max_redirects [Integer, nil] Maximum
|
|
529
|
+
# @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
|
|
499
530
|
# @param gzip [Boolean, nil] Enable gzip compression
|
|
500
531
|
# @param brotli [Boolean, nil] Enable Brotli compression
|
|
501
532
|
# @param deflate [Boolean, nil] Enable deflate compression
|
|
@@ -504,13 +535,15 @@ unless defined?(Wreq)
|
|
|
504
535
|
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
|
|
505
536
|
# @param proxy [String, nil] Proxy server URI
|
|
506
537
|
# @param local_address [String, nil] Bind the request'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.
|
|
507
|
-
# @param interface [String, nil] Bind
|
|
538
|
+
# @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
|
|
508
539
|
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
|
|
509
540
|
# @param version [Wreq::Version, nil] HTTP version to use
|
|
510
541
|
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
|
|
511
|
-
# @param json [Object, nil] JSON body
|
|
512
|
-
# @param body [String,
|
|
542
|
+
# @param json [Object, nil] JSON body serialized by the native encoder; Integer values retain arbitrary precision
|
|
543
|
+
# @param body [String, Wreq::BodySender, nil] Raw or streaming request body
|
|
513
544
|
# @return [Wreq::Response] HTTP response
|
|
545
|
+
# @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
|
|
546
|
+
# value cannot be converted, validated, or built
|
|
514
547
|
def patch(url, **options)
|
|
515
548
|
end
|
|
516
549
|
end
|