webmock 3.9.2 → 3.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +23 -6
- data/lib/webmock/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a87447f51d9795b044f000997ec83ce2d5673373a7a06dec331fa2de9d008bf
|
4
|
+
data.tar.gz: 5122a5da6a3914b138f1f1e1e690d82f1634f92af63da7efe4e1ac94f48ab4bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8af4021d6ab4e24f09a1bccebc87c2031067c78dfadf92b3a598df0eb56742c3eed1dae935bec0abcd892082933c14114e964a95d41369d9855f7417f3d6b149
|
7
|
+
data.tar.gz: 68f43e43910e6bce66eb847caca053fd94bf3fe363d838deb6e31e98b83d9013592a03d0df499f059b5473d4ad81401e6720e86ae9799a19e62f182d41ea24b0
|
data/CHANGELOG.md
CHANGED
@@ -43,6 +43,9 @@ if defined?(::HTTPClient)
|
|
43
43
|
end
|
44
44
|
|
45
45
|
module WebMockHTTPClients
|
46
|
+
|
47
|
+
REQUEST_RESPONSE_LOCK = Mutex.new
|
48
|
+
|
46
49
|
def do_get_block(req, proxy, conn, &block)
|
47
50
|
do_get(req, proxy, conn, false, &block)
|
48
51
|
end
|
@@ -57,7 +60,7 @@ if defined?(::HTTPClient)
|
|
57
60
|
WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
|
58
61
|
|
59
62
|
if webmock_responses[request_signature]
|
60
|
-
webmock_response = webmock_responses.delete(request_signature)
|
63
|
+
webmock_response = synchronize_request_response { webmock_responses.delete(request_signature) }
|
61
64
|
response = build_httpclient_response(webmock_response, stream, req.header, &block)
|
62
65
|
@request_filter.each do |filter|
|
63
66
|
filter.filter_response(req, response)
|
@@ -68,7 +71,7 @@ if defined?(::HTTPClient)
|
|
68
71
|
res
|
69
72
|
elsif WebMock.net_connect_allowed?(request_signature.uri)
|
70
73
|
# in case there is a nil entry in the hash...
|
71
|
-
webmock_responses.delete(request_signature)
|
74
|
+
synchronize_request_response { webmock_responses.delete(request_signature) }
|
72
75
|
|
73
76
|
res = if stream
|
74
77
|
do_get_stream_without_webmock(req, proxy, conn, &block)
|
@@ -100,7 +103,7 @@ if defined?(::HTTPClient)
|
|
100
103
|
def do_request_async(method, uri, query, body, extheader)
|
101
104
|
req = create_request(method, uri, query, body, extheader)
|
102
105
|
request_signature = build_request_signature(req)
|
103
|
-
webmock_request_signatures << request_signature
|
106
|
+
synchronize_request_response { webmock_request_signatures << request_signature }
|
104
107
|
|
105
108
|
if webmock_responses[request_signature] || WebMock.net_connect_allowed?(request_signature.uri)
|
106
109
|
super
|
@@ -184,7 +187,9 @@ if defined?(::HTTPClient)
|
|
184
187
|
|
185
188
|
def webmock_responses
|
186
189
|
@webmock_responses ||= Hash.new do |hash, request_signature|
|
187
|
-
|
190
|
+
synchronize_request_response do
|
191
|
+
hash[request_signature] = WebMock::StubRegistry.instance.response_for_request(request_signature)
|
192
|
+
end
|
188
193
|
end
|
189
194
|
end
|
190
195
|
|
@@ -193,8 +198,10 @@ if defined?(::HTTPClient)
|
|
193
198
|
end
|
194
199
|
|
195
200
|
def previous_signature_for(signature)
|
196
|
-
|
197
|
-
|
201
|
+
synchronize_request_response do
|
202
|
+
return nil unless index = webmock_request_signatures.index(signature)
|
203
|
+
webmock_request_signatures.delete_at(index)
|
204
|
+
end
|
198
205
|
end
|
199
206
|
|
200
207
|
private
|
@@ -209,6 +216,16 @@ if defined?(::HTTPClient)
|
|
209
216
|
hdrs
|
210
217
|
end
|
211
218
|
end
|
219
|
+
|
220
|
+
def synchronize_request_response
|
221
|
+
if REQUEST_RESPONSE_LOCK.owned?
|
222
|
+
yield
|
223
|
+
else
|
224
|
+
REQUEST_RESPONSE_LOCK.synchronize do
|
225
|
+
yield
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
212
229
|
end
|
213
230
|
|
214
231
|
class WebMockHTTPClient < HTTPClient
|
data/lib/webmock/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.9.
|
4
|
+
version: 3.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Blimke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -407,9 +407,9 @@ licenses:
|
|
407
407
|
- MIT
|
408
408
|
metadata:
|
409
409
|
bug_tracker_uri: https://github.com/bblimke/webmock/issues
|
410
|
-
changelog_uri: https://github.com/bblimke/webmock/blob/v3.9.
|
411
|
-
documentation_uri: https://www.rubydoc.info/gems/webmock/3.9.
|
412
|
-
source_code_uri: https://github.com/bblimke/webmock/tree/v3.9.
|
410
|
+
changelog_uri: https://github.com/bblimke/webmock/blob/v3.9.3/CHANGELOG.md
|
411
|
+
documentation_uri: https://www.rubydoc.info/gems/webmock/3.9.3
|
412
|
+
source_code_uri: https://github.com/bblimke/webmock/tree/v3.9.3
|
413
413
|
wiki_uri: https://github.com/bblimke/webmock/wiki
|
414
414
|
post_install_message:
|
415
415
|
rdoc_options: []
|