webmock 3.19.0 → 3.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/webmock/request_stub.rb +16 -3
- data/lib/webmock/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 379567500380d6df66bea0edab72f977ddbcab8fc2cc79f9c2e4c535c46cfeb4
|
4
|
+
data.tar.gz: fbab14a1e3a2d7a5563f293e735f521dc47481e7d574f4ace0e5cefa9a15fb8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 768bc4817766c1b5d2c799c8453bf59411d69f36c4d3b6dfc0630f2a830efa4b72b78dd999cce146bf8f4754a05fbd0dbbddcc72a7389f8b48b8546d4d98dba0
|
7
|
+
data.tar.gz: ca14f9cffef86ef82b52985f5ad58f662cbffcb33b86050ffd6e9390efaf5892eed0469595f153d7b0d8a8e6141a75a1e47cdd8076178385a92fe99593c8b3c3
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
# 3.19.0
|
4
4
|
|
5
|
+
* When passing a Proc or lambda as response body to `to_return_json`, the body is evaluated at the time of request and not at the time of `to_return_json` method invocation.
|
6
|
+
|
7
|
+
Thanks to [Jason Karns](https://github.com/jasonkarns) for reporting.
|
8
|
+
|
5
9
|
* Do not alter real (non-stubbed) request headers when handling em-http-request requests.
|
6
10
|
|
7
11
|
Thanks to [Yoann Lecuyer](https://github.com/ylecuyer)
|
data/lib/webmock/request_stub.rb
CHANGED
@@ -32,12 +32,25 @@ module WebMock
|
|
32
32
|
json_response_hashes = [*response_hashes].flatten.map do |resp_h|
|
33
33
|
headers, body = resp_h.values_at(:headers, :body)
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
json_body = if body.respond_to?(:call)
|
36
|
+
->(request_signature) {
|
37
|
+
b = if body.respond_to?(:arity) && body.arity == 1
|
38
|
+
body.call(request_signature)
|
39
|
+
else
|
40
|
+
body.call
|
41
|
+
end
|
42
|
+
b = b.to_json unless b.is_a?(String)
|
43
|
+
b
|
44
|
+
}
|
45
|
+
elsif !body.is_a?(String)
|
46
|
+
body.to_json
|
47
|
+
else
|
48
|
+
body
|
49
|
+
end
|
37
50
|
|
38
51
|
resp_h.merge(
|
39
52
|
headers: {content_type: 'application/json'}.merge(headers.to_h),
|
40
|
-
body:
|
53
|
+
body: json_body
|
41
54
|
)
|
42
55
|
end
|
43
56
|
|
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.19.
|
4
|
+
version: 3.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Blimke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -357,9 +357,9 @@ licenses:
|
|
357
357
|
- MIT
|
358
358
|
metadata:
|
359
359
|
bug_tracker_uri: https://github.com/bblimke/webmock/issues
|
360
|
-
changelog_uri: https://github.com/bblimke/webmock/blob/v3.19.
|
361
|
-
documentation_uri: https://www.rubydoc.info/gems/webmock/3.19.
|
362
|
-
source_code_uri: https://github.com/bblimke/webmock/tree/v3.19.
|
360
|
+
changelog_uri: https://github.com/bblimke/webmock/blob/v3.19.1/CHANGELOG.md
|
361
|
+
documentation_uri: https://www.rubydoc.info/gems/webmock/3.19.1
|
362
|
+
source_code_uri: https://github.com/bblimke/webmock/tree/v3.19.1
|
363
363
|
wiki_uri: https://github.com/bblimke/webmock/wiki
|
364
364
|
post_install_message:
|
365
365
|
rdoc_options: []
|
@@ -376,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
376
376
|
- !ruby/object:Gem::Version
|
377
377
|
version: '0'
|
378
378
|
requirements: []
|
379
|
-
rubygems_version: 3.4.
|
379
|
+
rubygems_version: 3.4.19
|
380
380
|
signing_key:
|
381
381
|
specification_version: 4
|
382
382
|
summary: Library for stubbing HTTP requests in Ruby.
|