wreq 1.2.4-aarch64-linux → 1.2.6-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/crates/wreq-util/.github/FUNDING.yml +15 -0
- data/crates/wreq-util/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/crates/wreq-util/.github/ISSUE_TEMPLATE/custom.md +10 -0
- data/crates/wreq-util/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/crates/wreq-util/.github/dependabot.yml +22 -0
- data/crates/wreq-util/.github/workflows/ci.yml +82 -0
- data/crates/wreq-util/.github/workflows/release-plz.yml +52 -0
- data/crates/wreq-util/.gitignore +24 -0
- data/crates/wreq-util/CHANGELOG.md +74 -0
- data/crates/wreq-util/LICENSE +201 -0
- data/crates/wreq-util/README.md +62 -0
- data/crates/wreq-util/release-plz.toml +2 -0
- data/crates/wreq-util/rustfmt.toml +5 -0
- data/examples/emulate_request.rb +1 -1
- data/lib/wreq.rb +72 -45
- data/lib/wreq_ruby/3.3/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/3.4/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/4.0/wreq_ruby.so +0 -0
- data/lib/wreq_ruby/body.rb +30 -9
- data/lib/wreq_ruby/client.rb +88 -55
- data/lib/wreq_ruby/cookie.rb +81 -21
- data/lib/wreq_ruby/emulate.rb +77 -7
- data/lib/wreq_ruby/error.rb +5 -7
- data/lib/wreq_ruby/header.rb +205 -114
- data/lib/wreq_ruby/http.rb +74 -0
- data/lib/wreq_ruby/response.rb +31 -3
- data/script/build_windows_gnu.ps1 +6 -0
- data/test/body_sender_test.rb +246 -0
- data/test/cookie_test.rb +211 -10
- data/test/header_test.rb +228 -192
- data/test/json_precision_test.rb +209 -0
- data/test/option_validation_test.rb +311 -0
- data/test/stream_test.rb +36 -0
- data/test/value_semantics_test.rb +238 -0
- metadata +19 -2
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class ValueSemanticsTest < Minitest::Test
|
|
6
|
+
# ---- StatusCode ----
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
@response = Wreq.get("#{HTTPBIN_URL}/status/201")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_status_code_to_i
|
|
13
|
+
assert_equal 201, @response.status.to_i
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_status_code_as_int_still_works
|
|
17
|
+
assert_equal 201, @response.status.as_int
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_status_code_to_i_matches_as_int
|
|
21
|
+
assert_equal @response.status.as_int, @response.status.to_i
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_status_code_equality
|
|
25
|
+
a = @response.status
|
|
26
|
+
b = @response.status
|
|
27
|
+
assert_equal a, b
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_status_code_eql
|
|
31
|
+
a = @response.status
|
|
32
|
+
b = @response.status
|
|
33
|
+
assert a.eql?(b)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_status_code_hash_consistent
|
|
37
|
+
a = @response.status
|
|
38
|
+
b = @response.status
|
|
39
|
+
assert_equal a.hash, b.hash
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_status_code_as_hash_key
|
|
43
|
+
status = @response.status
|
|
44
|
+
h = {status => "created"}
|
|
45
|
+
assert_equal "created", h[@response.status]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_status_code_in_set
|
|
49
|
+
s = Set.new
|
|
50
|
+
s.add(@response.status)
|
|
51
|
+
assert_includes s, @response.status
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_status_code_not_equal_to_integer
|
|
55
|
+
refute_equal @response.status, 201
|
|
56
|
+
refute @response.status.eql?(201)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def test_status_code_different_values_not_equal
|
|
60
|
+
ok = Wreq.get("#{HTTPBIN_URL}/status/200").status
|
|
61
|
+
created = @response.status
|
|
62
|
+
refute_equal ok, created
|
|
63
|
+
refute ok.eql?(created)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_response_code_still_returns_integer
|
|
67
|
+
assert_instance_of Integer, @response.code
|
|
68
|
+
assert_equal 201, @response.code
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# ---- Version ----
|
|
72
|
+
|
|
73
|
+
def test_version_equality
|
|
74
|
+
assert_equal Wreq::Version::HTTP_11, Wreq::Version::HTTP_11
|
|
75
|
+
assert_equal "HTTP/0.9", Wreq::Version::HTTP_09.to_s
|
|
76
|
+
assert_equal "HTTP/1.0", Wreq::Version::HTTP_10.to_s
|
|
77
|
+
assert_equal "HTTP/1.1", Wreq::Version::HTTP_11.to_s
|
|
78
|
+
assert_equal "HTTP/2.0", Wreq::Version::HTTP_2.to_s
|
|
79
|
+
assert_equal "HTTP/3.0", Wreq::Version::HTTP_3.to_s
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def test_version_eql
|
|
83
|
+
v = Wreq::Version::HTTP_11
|
|
84
|
+
assert v.eql?(Wreq::Version::HTTP_11)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_version_hash_consistent
|
|
88
|
+
a = Wreq::Version::HTTP_11
|
|
89
|
+
b = Wreq::Version::HTTP_11
|
|
90
|
+
assert_equal a.hash, b.hash
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_version_different_values_not_equal
|
|
94
|
+
refute_equal Wreq::Version::HTTP_11, Wreq::Version::HTTP_2
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def test_version_as_hash_key
|
|
98
|
+
v = Wreq::Version::HTTP_11
|
|
99
|
+
h = {v => "http1.1"}
|
|
100
|
+
assert_equal "http1.1", h[Wreq::Version::HTTP_11]
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def test_version_in_set
|
|
104
|
+
s = Set.new([Wreq::Version::HTTP_11, Wreq::Version::HTTP_2])
|
|
105
|
+
assert_includes s, Wreq::Version::HTTP_11
|
|
106
|
+
assert_includes s, Wreq::Version::HTTP_2
|
|
107
|
+
refute_includes s, Wreq::Version::HTTP_3
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# ---- Method ----
|
|
111
|
+
|
|
112
|
+
def test_method_to_s
|
|
113
|
+
assert_equal "GET", Wreq::Method::GET.to_s
|
|
114
|
+
assert_equal "POST", Wreq::Method::POST.to_s
|
|
115
|
+
assert_equal "PUT", Wreq::Method::PUT.to_s
|
|
116
|
+
assert_equal "DELETE", Wreq::Method::DELETE.to_s
|
|
117
|
+
assert_equal "HEAD", Wreq::Method::HEAD.to_s
|
|
118
|
+
assert_equal "OPTIONS", Wreq::Method::OPTIONS.to_s
|
|
119
|
+
assert_equal "TRACE", Wreq::Method::TRACE.to_s
|
|
120
|
+
assert_equal "PATCH", Wreq::Method::PATCH.to_s
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def test_method_to_sym
|
|
124
|
+
assert_equal :get, Wreq::Method::GET.to_sym
|
|
125
|
+
assert_equal :post, Wreq::Method::POST.to_sym
|
|
126
|
+
assert_equal :put, Wreq::Method::PUT.to_sym
|
|
127
|
+
assert_equal :delete, Wreq::Method::DELETE.to_sym
|
|
128
|
+
assert_equal :head, Wreq::Method::HEAD.to_sym
|
|
129
|
+
assert_equal :options, Wreq::Method::OPTIONS.to_sym
|
|
130
|
+
assert_equal :trace, Wreq::Method::TRACE.to_sym
|
|
131
|
+
assert_equal :patch, Wreq::Method::PATCH.to_sym
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def test_method_equality
|
|
135
|
+
assert_equal Wreq::Method::GET, Wreq::Method::GET
|
|
136
|
+
refute_equal Wreq::Method::GET, Wreq::Method::POST
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def test_method_eql
|
|
140
|
+
assert Wreq::Method::GET.eql?(Wreq::Method::GET)
|
|
141
|
+
refute Wreq::Method::GET.eql?(Wreq::Method::POST)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def test_method_hash_consistent
|
|
145
|
+
assert_equal Wreq::Method::GET.hash, Wreq::Method::GET.hash
|
|
146
|
+
refute_equal Wreq::Method::GET.hash, Wreq::Method::POST.hash
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def test_method_as_hash_key
|
|
150
|
+
h = {Wreq::Method::GET => "get it"}
|
|
151
|
+
assert_equal "get it", h[Wreq::Method::GET]
|
|
152
|
+
assert_nil h[Wreq::Method::POST]
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# ---- SameSite ----
|
|
156
|
+
|
|
157
|
+
def test_same_site_to_s
|
|
158
|
+
assert_equal "Strict", Wreq::SameSite::Strict.to_s
|
|
159
|
+
assert_equal "Lax", Wreq::SameSite::Lax.to_s
|
|
160
|
+
assert_equal "None", Wreq::SameSite::None.to_s
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def test_same_site_to_sym
|
|
164
|
+
assert_equal :strict, Wreq::SameSite::Strict.to_sym
|
|
165
|
+
assert_equal :lax, Wreq::SameSite::Lax.to_sym
|
|
166
|
+
assert_equal :none, Wreq::SameSite::None.to_sym
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def test_same_site_equality
|
|
170
|
+
assert_equal Wreq::SameSite::Lax, Wreq::SameSite::Lax
|
|
171
|
+
refute_equal Wreq::SameSite::Lax, Wreq::SameSite::Strict
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def test_same_site_eql_and_hash
|
|
175
|
+
assert Wreq::SameSite::Lax.eql?(Wreq::SameSite::Lax)
|
|
176
|
+
assert_equal Wreq::SameSite::Lax.hash, Wreq::SameSite::Lax.hash
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# ---- Profile ----
|
|
180
|
+
|
|
181
|
+
def test_profile_equality
|
|
182
|
+
assert_equal Wreq::Profile::Chrome134, Wreq::Profile::Chrome134
|
|
183
|
+
refute_equal Wreq::Profile::Chrome134, Wreq::Profile::Chrome135
|
|
184
|
+
assert_equal "Chrome134", Wreq::Profile::Chrome134.to_s
|
|
185
|
+
assert_equal "SafariIos17_4_1", Wreq::Profile::SafariIos17_4_1.to_s
|
|
186
|
+
assert_equal "OkHttp4_12", Wreq::Profile::OkHttp4_12.to_s
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def test_profile_eql_and_hash
|
|
190
|
+
assert Wreq::Profile::Chrome134.eql?(Wreq::Profile::Chrome134)
|
|
191
|
+
assert_equal Wreq::Profile::Chrome134.hash, Wreq::Profile::Chrome134.hash
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def test_profile_as_hash_key
|
|
195
|
+
h = {Wreq::Profile::Chrome134 => "chrome"}
|
|
196
|
+
assert_equal "chrome", h[Wreq::Profile::Chrome134]
|
|
197
|
+
assert_nil h[Wreq::Profile::Chrome135]
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# ---- Platform ----
|
|
201
|
+
|
|
202
|
+
def test_platform_equality
|
|
203
|
+
assert_equal Wreq::Platform::Windows, Wreq::Platform::Windows
|
|
204
|
+
refute_equal Wreq::Platform::Windows, Wreq::Platform::Linux
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def test_platform_eql_and_hash
|
|
208
|
+
assert Wreq::Platform::Windows.eql?(Wreq::Platform::Windows)
|
|
209
|
+
assert_equal Wreq::Platform::Windows.hash, Wreq::Platform::Windows.hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def test_platform_to_sym
|
|
213
|
+
assert_equal "Windows", Wreq::Platform::Windows.to_s
|
|
214
|
+
assert_equal "MacOS", Wreq::Platform::MacOS.to_s
|
|
215
|
+
assert_equal "Linux", Wreq::Platform::Linux.to_s
|
|
216
|
+
assert_equal "Android", Wreq::Platform::Android.to_s
|
|
217
|
+
assert_equal "IOS", Wreq::Platform::IOS.to_s
|
|
218
|
+
|
|
219
|
+
assert_equal :windows, Wreq::Platform::Windows.to_sym
|
|
220
|
+
assert_equal :macos, Wreq::Platform::MacOS.to_sym
|
|
221
|
+
assert_equal :linux, Wreq::Platform::Linux.to_sym
|
|
222
|
+
assert_equal :android, Wreq::Platform::Android.to_sym
|
|
223
|
+
assert_equal :ios, Wreq::Platform::IOS.to_sym
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# ---- Cross-type comparisons ----
|
|
227
|
+
|
|
228
|
+
def test_cross_type_not_equal
|
|
229
|
+
refute_equal Wreq::Method::GET, Wreq::Version::HTTP_11
|
|
230
|
+
refute_equal Wreq::SameSite::Lax, Wreq::Method::GET
|
|
231
|
+
refute_equal Wreq::Platform::Windows, Wreq::Profile::Chrome134
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def test_cross_type_eql_false
|
|
235
|
+
refute Wreq::Method::GET.eql?(Wreq::Version::HTTP_11)
|
|
236
|
+
refute Wreq::SameSite::Lax.eql?(Wreq::Method::GET)
|
|
237
|
+
end
|
|
238
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wreq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.6
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- SearchApi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: An easy and powerful Ruby HTTP client with advanced browser fingerprinting
|
|
14
14
|
that accurately emulates Chrome, Edge, Firefox, Safari, Opera, and OkHttp with precise
|
|
@@ -24,6 +24,19 @@ files:
|
|
|
24
24
|
- LICENSE
|
|
25
25
|
- README.md
|
|
26
26
|
- Rakefile
|
|
27
|
+
- crates/wreq-util/.github/FUNDING.yml
|
|
28
|
+
- crates/wreq-util/.github/ISSUE_TEMPLATE/bug_report.md
|
|
29
|
+
- crates/wreq-util/.github/ISSUE_TEMPLATE/custom.md
|
|
30
|
+
- crates/wreq-util/.github/ISSUE_TEMPLATE/feature_request.md
|
|
31
|
+
- crates/wreq-util/.github/dependabot.yml
|
|
32
|
+
- crates/wreq-util/.github/workflows/ci.yml
|
|
33
|
+
- crates/wreq-util/.github/workflows/release-plz.yml
|
|
34
|
+
- crates/wreq-util/.gitignore
|
|
35
|
+
- crates/wreq-util/CHANGELOG.md
|
|
36
|
+
- crates/wreq-util/LICENSE
|
|
37
|
+
- crates/wreq-util/README.md
|
|
38
|
+
- crates/wreq-util/release-plz.toml
|
|
39
|
+
- crates/wreq-util/rustfmt.toml
|
|
27
40
|
- docs/windows-gnu-tokio-crash.md
|
|
28
41
|
- examples/body.rb
|
|
29
42
|
- examples/client.rb
|
|
@@ -48,6 +61,7 @@ files:
|
|
|
48
61
|
- lib/wreq_ruby/response.rb
|
|
49
62
|
- script/build_platform_gem.rb
|
|
50
63
|
- script/build_windows_gnu.ps1
|
|
64
|
+
- test/body_sender_test.rb
|
|
51
65
|
- test/client_cookie_test.rb
|
|
52
66
|
- test/client_test.rb
|
|
53
67
|
- test/cookie_test.rb
|
|
@@ -55,13 +69,16 @@ files:
|
|
|
55
69
|
- test/error_handling_test.rb
|
|
56
70
|
- test/header_test.rb
|
|
57
71
|
- test/inspect_test.rb
|
|
72
|
+
- test/json_precision_test.rb
|
|
58
73
|
- test/module_methods_test.rb
|
|
74
|
+
- test/option_validation_test.rb
|
|
59
75
|
- test/orig_header_test.rb
|
|
60
76
|
- test/request_parameters_test.rb
|
|
61
77
|
- test/request_test.rb
|
|
62
78
|
- test/response_test.rb
|
|
63
79
|
- test/stream_test.rb
|
|
64
80
|
- test/test_helper.rb
|
|
81
|
+
- test/value_semantics_test.rb
|
|
65
82
|
- wreq.gemspec
|
|
66
83
|
homepage: https://github.com/SearchApi/wreq-ruby
|
|
67
84
|
licenses:
|