-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.rb
More file actions
516 lines (506 loc) · 28.7 KB
/
client.rb
File metadata and controls
516 lines (506 loc) · 28.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# frozen_string_literal: true
unless defined?(Wreq)
module Wreq
# HTTP client with extensive configuration options.
#
# This class wraps a native Rust implementation providing high-performance
# HTTP/1.1 and HTTP/2 client functionality with support for connection pooling,
# compression, redirects, proxies, and fine-grained timeout controls.
#
# The client is thread-safe and maintains an internal connection pool for
# efficient request reuse.
#
# @example Basic usage
# client = Wreq::Client.new
# # Use client for HTTP requests
#
# @example With common options
# client = Wreq::Client.new(
# user_agent: "MyApp/1.0",
# timeout: 30,
# gzip: true,
# brotli: true
# )
#
# @see https://github.com/your-repo/wreq-ruby Full documentation
class Client
# Create a new HTTP client instance.
#
# All options are optional. Time-related numeric values are expressed in seconds.
#
# @param emulation [Wreq::Emulation, nil] Device and OS emulation settings.
# If specified, the client will modify request headers and behaviors
#
# @param user_agent [String, nil] Custom User-Agent header value.
# If not specified, a default user agent will be used.
#
# @param headers [Hash{String=>String}, nil] Default headers to include
# in every request. Header names are case-insensitive. These headers
# can be overridden on a per-request basis.
#
# @param referer [Boolean, nil] Whether to automatically send Referer
# headers when following redirects. When true, the previous URL will
# be sent as the Referer header.
#
# @param allow_redirects [Boolean, nil] Enable automatic following of
# HTTP redirects (3xx status codes). When false, redirect responses
# will be returned directly to the caller.
#
# @param max_redirects [Integer, nil] Maximum number of redirects to
# follow before returning an error. Only applies when allow_redirects
# is true. Default is typically 10 if not specified.
#
# @param cookie_store [Boolean, nil] Enable an in-memory cookie jar
# that automatically handles Set-Cookie headers and sends appropriate
# Cookie headers on subsequent requests.
#
# @param cookie_provider [Wreq::Jar, nil] Custom cookie jar provider
# used to store and retrieve cookies for all requests made by this
# client. Typically used together with `cookie_store: true`.
#
# @param timeout [Integer, nil] Overall timeout for the entire request
# in seconds, including connection establishment, request transmission,
# and response reading. If not set, requests may wait indefinitely.
#
# @param connect_timeout [Integer, nil] Maximum time in seconds to wait
# when establishing a connection to the remote server. This is separate
# from the overall timeout.
#
# @param read_timeout [Integer, nil] Maximum time in seconds to wait
# between reading chunks of data from the server. Applies to each
# read operation, not the entire response.
#
# @param tcp_keepalive [Integer, nil] Time in seconds that a connection
# must be idle before TCP keepalive probes are sent. Helps detect
# broken connections.
#
# @param tcp_keepalive_interval [Integer, nil] Time in seconds between
# individual TCP keepalive probes. Only relevant if tcp_keepalive is set.
#
# @param tcp_keepalive_retries [Integer, nil] Number of failed keepalive
# probes before the connection is considered dead and closed.
#
# @param tcp_user_timeout [Integer, nil] Maximum time in seconds that
# transmitted data may remain unacknowledged before the connection is
# forcibly closed. Linux-specific option (Android, Fuchsia, Linux only).
#
# @param tcp_nodelay [Boolean, nil] Enable TCP_NODELAY socket option,
# which disables Nagle's algorithm. When true, small packets are sent
# immediately rather than being buffered. Useful for reducing latency
# in interactive protocols.
#
# @param tcp_reuse_address [Boolean, nil] Enable SO_REUSEADDR socket option,
# allowing the reuse of local addresses in TIME_WAIT state. Useful for
# reducing port exhaustion in high-throughput scenarios.
#
# @param pool_idle_timeout [Integer, nil] Time in seconds before idle
# connections in the pool are evicted and closed. Helps free up
# resources for long-running applications.
#
# @param pool_max_idle_per_host [Integer, nil] Maximum number of idle
# connections to maintain per host in the connection pool. Connections
# beyond this limit will be closed immediately after use.
#
# @param pool_max_size [Integer, nil] Total maximum size of the connection
# pool across all hosts. Once reached, new requests may need to wait
# for existing connections to become available.
#
# @param http1_only [Boolean, nil] Force the client to use HTTP/1.1 only,
# even if HTTP/2 is available. Useful for compatibility with servers
# that have problematic HTTP/2 implementations.
#
# @param http2_only [Boolean, nil] Force the client to use HTTP/2 only.
# Requests to servers that don't support HTTP/2 will fail. Cannot be
# combined with http1_only.
#
# @param https_only [Boolean, nil] Reject plain HTTP connections and
# only allow HTTPS. Provides an additional layer of security by
# preventing accidental cleartext connections.
#
# @param verify [Boolean, nil] Enable or disable TLS certificate
# verification. When false, the client will accept any certificate,
# including self-signed or expired ones. Should only be disabled
# for testing purposes.
#
# @param no_proxy [Boolean, nil] Disable use of any configured proxy
# for this client, even if proxy settings are detected from the
# environment.
#
# @param proxy [String, nil] Proxy server URI to use for all requests.
# Supports HTTP, HTTPS, and SOCKS5 proxies. Format: "protocol://host:port"
# Example: "http://proxy.example.com:8080"
# @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.
# @param interface [String, nil] Bind the socket to a specific network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0"). Effective only on systems that support the option (Linux/Android/Fuchsia) and typically requires privileges (root or CAP_NET_ADMIN).
#
# @param gzip [Boolean, nil] Accept and automatically decompress gzip
# content encoding. When true, adds "Accept-Encoding: gzip" header.
#
# @param brotli [Boolean, nil] Accept and automatically decompress Brotli
# content encoding. When true, adds "Accept-Encoding: br" header.
# Provides better compression than gzip.
#
# @param deflate [Boolean, nil] Accept and automatically decompress deflate
# content encoding. When true, adds "Accept-Encoding: deflate" header.
#
# @param zstd [Boolean, nil] Accept and automatically decompress Zstandard
# content encoding. When true, adds "Accept-Encoding: zstd" header.
# Modern compression algorithm with excellent performance.
#
# @return [Wreq::Client] A configured HTTP client instance ready to make requests.
#
# @raise [ArgumentError] if incompatible options are specified together
# (e.g., http1_only and http2_only both true).
# @raise [RuntimeError] if the underlying client cannot be initialized
# due to system resource constraints or invalid configuration.
#
# @example Minimal client
# client = Wreq::Client.new
#
# @example Client with custom headers
# client = Wreq::Client.new(
# user_agent: "MyApp/2.0 (https://example.com)",
# headers: {
# "Accept" => "application/json",
# "X-API-Key" => "secret-key-here"
# }
# )
#
# @example Client with timeouts
# client = Wreq::Client.new(
# timeout: 30, # 30 seconds total
# connect_timeout: 5, # 5 seconds to connect
# read_timeout: 10 # 10 seconds between reads
# )
#
# @example Client with redirect handling
# client = Wreq::Client.new(
# allow_redirects: true,
# max_redirects: 5,
# referer: true,
# history: true
# )
#
# @example Client with compression
# client = Wreq::Client.new(
# gzip: true,
# brotli: true,
# zstd: true
# )
#
# @example Client with proxy
# client = Wreq::Client.new(
# proxy: "http://proxy.corp.com:8080"
# )
#
# @example Client with SOCKS5 proxy
# client = Wreq::Client.new(
# proxy: "socks5://localhost:1080"
# )
#
# @example HTTPS-only client with strict verification
# client = Wreq::Client.new(
# https_only: true,
# verify: true
# )
#
# @example HTTP/2 optimized client
# client = Wreq::Client.new(
# http2_only: true,
# tcp_nodelay: true
# )
#
# @example Connection pool tuning
# client = Wreq::Client.new(
# pool_max_idle_per_host: 32,
# pool_idle_timeout: 90,
# pool_max_size: 128
# )
#
# @example TCP keepalive configuration
# client = Wreq::Client.new(
# tcp_keepalive: 60,
# tcp_keepalive_interval: 10,
# tcp_keepalive_retries: 3
# )
#
# @example Development/testing client (insecure)
# client = Wreq::Client.new(
# verify: false, # WARNING: Do not use in production!
# timeout: 5
# )
def self.new(**options)
end
# Send an HTTP request.
#
# @param method [Wreq::Method] HTTP method to use
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @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.
# @param interface [String, nil] Bind the socket to a specific network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0"). Effective only on systems that support the option (Linux/Android/Fuchsia) and typically requires privileges (root or CAP_NET_ADMIN).
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def request(method, url, **options)
end
# Send an HTTP GET request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate GET requests from a specific address. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable.
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0"). Supported on Linux/Android/Fuchsia; typically requires privileges.
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def get(url, **options)
end
# Send an HTTP HEAD request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate HEAD requests from a specific address. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1".
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0").
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def head(url, **options)
end
# Send an HTTP POST request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate POST requests from a specific address.
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def post(url, **options)
end
# Send an HTTP PUT request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate PUT requests from a specific address.
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def put(url, **options)
end
# Send an HTTP DELETE request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate DELETE requests from a specific address.
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def delete(url, **options)
end
# Send an HTTP OPTIONS request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate OPTIONS requests from a specific address.
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def options(url, **options)
end
# Send an HTTP TRACE request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate OPTIONS requests from a specific address.
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def trace(url, **options)
end
# Send an HTTP PATCH request.
#
# @param url [String] Target URL
# @param headers [Hash{String=>String}, nil] Custom headers for this request
# @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
# @param default_headers [Hash{String=>String}, nil] Default headers to merge
# @param query [Hash, nil] URL query parameters
# @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
# @param json [Object, nil] JSON body (will be serialized)
# @param body [String, IO, nil] Raw request body (string or stream)
# @param auth [String, nil] Authorization header value
# @param bearer_auth [String, nil] Bearer token for Authorization header
# @param basic_auth [Array<String>, nil] Username and password for basic auth
# @param cookies [Array<String>, nil] Cookies to send
# @param allow_redirects [Boolean, nil] Whether to follow redirects
# @param max_redirects [Integer, nil] Maximum number of redirects to follow
# @param gzip [Boolean, nil] Enable gzip compression
# @param brotli [Boolean, nil] Enable Brotli compression
# @param deflate [Boolean, nil] Enable deflate compression
# @param zstd [Boolean, nil] Enable Zstandard compression
# @param timeout [Integer, nil] Total request timeout (seconds)
# @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
# @param proxy [String, nil] Proxy server URI
# @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate OPTIONS requests from a specific address.
# @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
# @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
# @param version [Wreq::Version, nil] HTTP version to use
# @return [Wreq::Response] HTTP response
def patch(url, **options)
end
end
end
end