wreq 1.2.5-aarch64-linux → 1.2.6-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wreq.rb +70 -45
- data/lib/wreq_ruby/3.3/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/3.4/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/4.0/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/body.rb +29 -11
- data/lib/wreq_ruby/client.rb +88 -55
- data/lib/wreq_ruby/cookie.rb +79 -19
- data/lib/wreq_ruby/emulate.rb +74 -6
- data/lib/wreq_ruby/error.rb +5 -7
- data/lib/wreq_ruby/http.rb +74 -0
- data/lib/wreq_ruby/response.rb +3 -0
- data/script/build_windows_gnu.ps1 +6 -0
- data/test/body_sender_test.rb +246 -0
- data/test/cookie_test.rb +211 -10
- data/test/json_precision_test.rb +209 -0
- data/test/option_validation_test.rb +311 -0
- data/test/value_semantics_test.rb +238 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 908bcf2c57df2f5b5307ac3e1705702cc37dea141a8e405d8677d41a66a1b27c
|
|
4
|
+
data.tar.gz: 4988ae3fd70f97aabc4cd628a007295eac6fc070f28eda0962be10507dbc5a14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61593576f9ad8326ee3e24308fda204b003c1144eec94d88ce6989389e605b90ad6f30b396f95ffef60bb4359241032c423c0b73cc0ba0787db31b1bbca7836e
|
|
7
|
+
data.tar.gz: 94a42f93749674470c97d9e7777827b20a908b316782858c51bf48093cec70187e251f590585d34c66583d8c8aa52b86f36b7c3193a09dff89ccd40a78699b65
|
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
|
|
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
|
|
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
|
|
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
|
|
52
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
83
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
114
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
145
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
176
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
207
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
238
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
269
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
300
|
-
# @param body [String, Wreq::BodySender, nil]
|
|
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
|
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,25 +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
|
|
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 [
|
|
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
|
|
34
|
-
#
|
|
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
|