wreq 1.2.5-x86_64-linux → 1.2.6-x86_64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ed209c7fcbba5d84bfad7fa3da9d5459a1468396bb50b21b31c99de2ecea870
4
- data.tar.gz: de09533414435d3c50572e4876df5f8dfe18adb96f5504e42b0274b32b6e458b
3
+ metadata.gz: 92e7474db16ed2402299619c5810018fad110426be40b823dc661427febd1dec
4
+ data.tar.gz: 2bfa63ed7bba9967543083ebb792fa33b81398f37e9cf71fea5e718a50da56c7
5
5
  SHA512:
6
- metadata.gz: 93048c3f7e37eb3952548dde41e173d69edb707cdd9ecb5e0b24d7df1cbede6684045a02c53d3b6474f42aa71eb3bba6587d2793094da21b7ef9fd0fd14fe6b4
7
- data.tar.gz: 0ecedc0a7508990dc4fef408e9a191c4c657042328c6926aaa539a1ec303b03e5788a6158e4e15e06c7a45790ad943232c814ecefe3ce93e91de3f7c79cca8b2
6
+ metadata.gz: 8f46547e76ac3ab622c91cab11918bb720955841d9862b6a672f113cd47113f7b96f4a2b5e2ad0b66e039962c3e0ee0f5e4a7a789b1f24a0b6278c2c78840bd4
7
+ data.tar.gz: 856a9592e1fcb72a7c868e144040e10bd796cf7bd47b96e9755ed29fc2bcc683c36d4c0b1f2114692ef6cdf25c2b10560b41675faf1a6647e661b3e9220e3ab9
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"
@@ -22,20 +23,26 @@ unless defined?(Wreq)
22
23
  # @return [String]
23
24
  VERSION = nil
24
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
+
25
32
  # Send an HTTP request.
26
33
  #
27
34
  # @param method [Wreq::Method] HTTP method to use
28
35
  # @param url [String] Target URL
29
36
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
30
37
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
31
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
38
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
32
39
  # @param query [Hash, nil] URL query parameters
33
40
  # @param auth [String, nil] Authorization header value
34
41
  # @param bearer_auth [String, nil] Bearer token for Authorization header
35
42
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
36
43
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
37
44
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
38
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
45
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
39
46
  # @param gzip [Boolean, nil] Enable gzip compression
40
47
  # @param brotli [Boolean, nil] Enable Brotli compression
41
48
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -44,13 +51,15 @@ unless defined?(Wreq)
44
51
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
45
52
  # @param proxy [String, nil] Proxy server URI
46
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.
47
- # @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).
54
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
48
55
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
49
56
  # @param version [Wreq::Version, nil] HTTP version to use
50
57
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
51
- # @param json [Object, nil] JSON body (will be serialized)
52
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
53
60
  # @return [Wreq::Response] HTTP response
61
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
62
+ # value cannot be converted, validated, or built
54
63
  def self.request(method, url, **options)
55
64
  end
56
65
 
@@ -59,14 +68,14 @@ unless defined?(Wreq)
59
68
  # @param url [String] Target URL
60
69
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
61
70
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
62
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
71
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
63
72
  # @param query [Hash, nil] URL query parameters
64
73
  # @param auth [String, nil] Authorization header value
65
74
  # @param bearer_auth [String, nil] Bearer token for Authorization header
66
75
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
67
76
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
68
77
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
69
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
78
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
70
79
  # @param gzip [Boolean, nil] Enable gzip compression
71
80
  # @param brotli [Boolean, nil] Enable Brotli compression
72
81
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -75,13 +84,15 @@ unless defined?(Wreq)
75
84
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
76
85
  # @param proxy [String, nil] Proxy server URI
77
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.
78
- # @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).
87
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
79
88
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
80
89
  # @param version [Wreq::Version, nil] HTTP version to use
81
90
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
82
- # @param json [Object, nil] JSON body (will be serialized)
83
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
84
93
  # @return [Wreq::Response] HTTP response
94
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
95
+ # value cannot be converted, validated, or built
85
96
  def self.get(url, **options)
86
97
  end
87
98
 
@@ -90,14 +101,14 @@ unless defined?(Wreq)
90
101
  # @param url [String] Target URL
91
102
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
92
103
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
93
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
104
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
94
105
  # @param query [Hash, nil] URL query parameters
95
106
  # @param auth [String, nil] Authorization header value
96
107
  # @param bearer_auth [String, nil] Bearer token for Authorization header
97
108
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
98
109
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
99
110
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
100
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
111
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
101
112
  # @param gzip [Boolean, nil] Enable gzip compression
102
113
  # @param brotli [Boolean, nil] Enable Brotli compression
103
114
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -106,13 +117,15 @@ unless defined?(Wreq)
106
117
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
107
118
  # @param proxy [String, nil] Proxy server URI
108
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.
109
- # @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).
120
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
110
121
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
111
122
  # @param version [Wreq::Version, nil] HTTP version to use
112
123
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
113
- # @param json [Object, nil] JSON body (will be serialized)
114
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
115
126
  # @return [Wreq::Response] HTTP response
127
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
128
+ # value cannot be converted, validated, or built
116
129
  def self.head(url, **options)
117
130
  end
118
131
 
@@ -121,14 +134,14 @@ unless defined?(Wreq)
121
134
  # @param url [String] Target URL
122
135
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
123
136
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
124
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
137
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
125
138
  # @param query [Hash, nil] URL query parameters
126
139
  # @param auth [String, nil] Authorization header value
127
140
  # @param bearer_auth [String, nil] Bearer token for Authorization header
128
141
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
129
142
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
130
143
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
131
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
144
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
132
145
  # @param gzip [Boolean, nil] Enable gzip compression
133
146
  # @param brotli [Boolean, nil] Enable Brotli compression
134
147
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -137,13 +150,15 @@ unless defined?(Wreq)
137
150
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
138
151
  # @param proxy [String, nil] Proxy server URI
139
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.
140
- # @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).
153
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
141
154
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
142
155
  # @param version [Wreq::Version, nil] HTTP version to use
143
156
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
144
- # @param json [Object, nil] JSON body (will be serialized)
145
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
146
159
  # @return [Wreq::Response] HTTP response
160
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
161
+ # value cannot be converted, validated, or built
147
162
  def self.post(url, **options)
148
163
  end
149
164
 
@@ -152,14 +167,14 @@ unless defined?(Wreq)
152
167
  # @param url [String] Target URL
153
168
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
154
169
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
155
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
170
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
156
171
  # @param query [Hash, nil] URL query parameters
157
172
  # @param auth [String, nil] Authorization header value
158
173
  # @param bearer_auth [String, nil] Bearer token for Authorization header
159
174
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
160
175
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
161
176
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
162
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
177
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
163
178
  # @param gzip [Boolean, nil] Enable gzip compression
164
179
  # @param brotli [Boolean, nil] Enable Brotli compression
165
180
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -168,13 +183,15 @@ unless defined?(Wreq)
168
183
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
169
184
  # @param proxy [String, nil] Proxy server URI
170
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.
171
- # @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).
186
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
172
187
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
173
188
  # @param version [Wreq::Version, nil] HTTP version to use
174
189
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
175
- # @param json [Object, nil] JSON body (will be serialized)
176
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
177
192
  # @return [Wreq::Response] HTTP response
193
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
194
+ # value cannot be converted, validated, or built
178
195
  def self.put(url, **options)
179
196
  end
180
197
 
@@ -183,14 +200,14 @@ unless defined?(Wreq)
183
200
  # @param url [String] Target URL
184
201
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
185
202
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
186
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
203
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
187
204
  # @param query [Hash, nil] URL query parameters
188
205
  # @param auth [String, nil] Authorization header value
189
206
  # @param bearer_auth [String, nil] Bearer token for Authorization header
190
207
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
191
208
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
192
209
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
193
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
210
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
194
211
  # @param gzip [Boolean, nil] Enable gzip compression
195
212
  # @param brotli [Boolean, nil] Enable Brotli compression
196
213
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -199,13 +216,15 @@ unless defined?(Wreq)
199
216
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
200
217
  # @param proxy [String, nil] Proxy server URI
201
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.
202
- # @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).
219
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
203
220
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
204
221
  # @param version [Wreq::Version, nil] HTTP version to use
205
222
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
206
- # @param json [Object, nil] JSON body (will be serialized)
207
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
208
225
  # @return [Wreq::Response] HTTP response
226
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
227
+ # value cannot be converted, validated, or built
209
228
  def self.delete(url, **options)
210
229
  end
211
230
 
@@ -214,14 +233,14 @@ unless defined?(Wreq)
214
233
  # @param url [String] Target URL
215
234
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
216
235
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
217
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
236
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
218
237
  # @param query [Hash, nil] URL query parameters
219
238
  # @param auth [String, nil] Authorization header value
220
239
  # @param bearer_auth [String, nil] Bearer token for Authorization header
221
240
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
222
241
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
223
242
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
224
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
243
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
225
244
  # @param gzip [Boolean, nil] Enable gzip compression
226
245
  # @param brotli [Boolean, nil] Enable Brotli compression
227
246
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -230,13 +249,15 @@ unless defined?(Wreq)
230
249
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
231
250
  # @param proxy [String, nil] Proxy server URI
232
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.
233
- # @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).
252
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
234
253
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
235
254
  # @param version [Wreq::Version, nil] HTTP version to use
236
255
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
237
- # @param json [Object, nil] JSON body (will be serialized)
238
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
239
258
  # @return [Wreq::Response] HTTP response
259
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
260
+ # value cannot be converted, validated, or built
240
261
  def self.options(url, **options)
241
262
  end
242
263
 
@@ -245,14 +266,14 @@ unless defined?(Wreq)
245
266
  # @param url [String] Target URL
246
267
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
247
268
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
248
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
269
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
249
270
  # @param query [Hash, nil] URL query parameters
250
271
  # @param auth [String, nil] Authorization header value
251
272
  # @param bearer_auth [String, nil] Bearer token for Authorization header
252
273
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
253
274
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
254
275
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
255
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
276
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
256
277
  # @param gzip [Boolean, nil] Enable gzip compression
257
278
  # @param brotli [Boolean, nil] Enable Brotli compression
258
279
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -261,13 +282,15 @@ unless defined?(Wreq)
261
282
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
262
283
  # @param proxy [String, nil] Proxy server URI
263
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.
264
- # @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).
285
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
265
286
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
266
287
  # @param version [Wreq::Version, nil] HTTP version to use
267
288
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
268
- # @param json [Object, nil] JSON body (will be serialized)
269
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
270
291
  # @return [Wreq::Response] HTTP response
292
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
293
+ # value cannot be converted, validated, or built
271
294
  def self.trace(url, **options)
272
295
  end
273
296
 
@@ -276,14 +299,14 @@ unless defined?(Wreq)
276
299
  # @param url [String] Target URL
277
300
  # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
278
301
  # @param orig_headers [Array<String>, nil] Original header names used to preserve raw header order and HTTP/1 case-sensitive header handling
279
- # @param default_headers [Boolean, nil] Whether to apply default emulation headers
302
+ # @param default_headers [Boolean, nil] Whether to apply native default headers
280
303
  # @param query [Hash, nil] URL query parameters
281
304
  # @param auth [String, nil] Authorization header value
282
305
  # @param bearer_auth [String, nil] Bearer token for Authorization header
283
306
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
284
307
  # @param cookies [Hash{String=>String}, String, nil] Cookies to send
285
308
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
286
- # @param max_redirects [Integer, nil] Maximum number of redirects to follow
309
+ # @param max_redirects [Integer, nil] Maximum redirects; requires allow_redirects: true
287
310
  # @param gzip [Boolean, nil] Enable gzip compression
288
311
  # @param brotli [Boolean, nil] Enable Brotli compression
289
312
  # @param deflate [Boolean, nil] Enable deflate compression
@@ -292,13 +315,15 @@ unless defined?(Wreq)
292
315
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
293
316
  # @param proxy [String, nil] Proxy server URI
294
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.
295
- # @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).
318
+ # @param interface [String, nil] Bind to an interface on supported platforms; unsupported platforms raise ArgumentError.
296
319
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
297
320
  # @param version [Wreq::Version, nil] HTTP version to use
298
321
  # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
299
- # @param json [Object, nil] JSON body (will be serialized)
300
- # @param body [String, Wreq::BodySender, nil] Request body bytes or streaming body sender
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
301
324
  # @return [Wreq::Response] HTTP response
325
+ # @raise [TypeError, ArgumentError, Wreq::BuilderError] if a known option
326
+ # value cannot be converted, validated, or built
302
327
  def self.patch(url, **options)
303
328
  end
304
329
  end
Binary file
Binary file
Binary file
@@ -2,10 +2,10 @@
2
2
 
3
3
  unless defined?(Wreq)
4
4
  module Wreq
5
- # BodySender: for streaming request bodies, allowing thread-safe chunked data push.
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
- # Supports multi-threaded chunk push: you can safely call `push` from multiple threads.
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,25 +15,43 @@ unless defined?(Wreq)
15
15
  # end
16
16
  # resp = client.post(url, body: sender)
17
17
  #
18
- # Note:
19
- # - Sender is for request upload only, not for response reading.
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
- # @param capacity [Integer] channel buffer size, default 8
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
24
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
25
28
  def self.new(capacity = 8)
26
29
  end
27
30
 
31
+ # Push one binary chunk, waiting while the channel is full.
32
+ #
28
33
  # @param data [String] binary chunk
29
- # @return [void]
34
+ # @return [nil]
35
+ # @raise [IOError] if the sender or receiving side is closed
30
36
  def push(data)
31
37
  end
32
38
 
33
- # Close the sender, signaling end of data.
34
- # @return [void]
39
+ # Close the producer and signal EOF after all queued chunks are read.
40
+ #
41
+ # This operation is idempotent.
42
+ #
43
+ # @return [nil]
35
44
  def close
36
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
37
55
  end
38
56
  end
39
57
  end