webmock 3.21.1 → 3.21.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00fe33740b645d6ee1a843e8a863287c784171a411e36a6a03a9964d1a0f5d1e
4
- data.tar.gz: 581a52244e5ae82837eefbbc750d3785db5c465380885a865332d7c483c73acd
3
+ metadata.gz: ad4b861d9b998186e2b85f1da5e35dce4451d13d16822cf35f42d52fbce40de0
4
+ data.tar.gz: e7395eb84a1688a56f6916b4a58992cf1a88bcee695eb2e7f015260d33d3c677
5
5
  SHA512:
6
- metadata.gz: 3693a98690a3c2a4e2fa32721fee8e5c4fbe7a541e33465707f99fd980bd67a57e2f31ba4f51e13121ac65302ec0d41e154bdde447053bbfd56452d8016e65e1
7
- data.tar.gz: 254ba266ba69ab8edb4d48ce83c563e0fa514b778bfbf8c0a695150606e1ad954961abdb69f48a95097960681fa79db8e258f46db28ed250522de57eba8b89f2
6
+ metadata.gz: 1599e16d961cf7a5a87fe2ac9030cd33ccb5d20d645832e317a36cbad45e4d4836cd506016d0f5a5a5ee69c502e7993ed8a33c6fce080b9a40aa5626f2a212b5
7
+ data.tar.gz: 044b1c3bc0ec98535f4949649984b33475390a1f5b4213abba21a61c357d93173088214c3e5dd4ef943ac21800485cd078ad5ef2bc722c7563c9fa8b5fd80ea5
data/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ # 3.21.2
4
+
5
+ * Corrected type checking in `WebMock::Response#assert_valid_body!` to accurately recognize `Hash` objects. Additionally, improved the clarity of the error message for unsupported body types, guiding users towards proper usage.
6
+
7
+ Thanks to [Jake Robb](https://github.com/jakerobb) for reporting.
8
+
3
9
  # 3.21.1
4
10
 
5
11
  * The stubbed Net::HTTPResponse#uri now returns request.uri, aligning it with the behavior of an actual Net::HTTPResponse.
6
12
 
13
+ Thanks to [Abe Voelker](https://github.com/abevoelker) for reporting and to [Victor Maslov](https://github.com/Nakilon) and [Gio Lodi](https://github.com/mokagio) for the suggested solution.
14
+
7
15
  # 3.21.0
8
16
 
9
17
  * Don't use deprecated Rack::VERSION for Rack >= 3
@@ -192,7 +200,7 @@
192
200
 
193
201
  * Fixed async-http adapter to only considered requests as real if they are real.
194
202
 
195
- Thanks to Thanks to [Tony Schneider](https://github.com/tonywok) and [Samuel Williams](https://github.com/ioquatix)
203
+ Thanks to [Tony Schneider](https://github.com/tonywok) and [Samuel Williams](https://github.com/ioquatix)
196
204
 
197
205
  # 3.11.2
198
206
 
data/README.md CHANGED
@@ -606,7 +606,11 @@ which can be passed to `WebMock.allow_net_connect!` and `WebMock.disable_net_con
606
606
  WebMock.allow_net_connect!(net_http_connect_on_start: true)
607
607
  ```
608
608
 
609
- This forces WebMock Net::HTTP adapter to always connect on `Net::HTTP.start`.
609
+ This forces WebMock Net::HTTP adapter to always connect on `Net::HTTP.start`. At the time of connection being made there is no information about the request or URL yet, therefore WebMock is not able to decide whether to stub a request or not and all connections are allowed. To enable connections only to a specific domain (e.g. your test server) use:
610
+
611
+ ```ruby
612
+ WebMock.allow_net_connect!(net_http_connect_on_start: "www.example.com")
613
+ ```
610
614
 
611
615
  ## Setting Expectations
612
616
 
@@ -1195,6 +1199,9 @@ People who submitted patches and new features or suggested improvements. Many th
1195
1199
  * Kazuhiro NISHIYAMA
1196
1200
  * Étienne Barrié
1197
1201
  * Matt Brown
1202
+ * Victor Maslov
1203
+ * Gio Lodi
1204
+ * Ryan Brooks
1198
1205
 
1199
1206
  For a full list of contributors you can visit the
1200
1207
  [contributors](https://github.com/bblimke/webmock/contributors) page.
@@ -117,11 +117,11 @@ module WebMock
117
117
  return if @body.nil?
118
118
  return if valid_types.any? { |c| @body.is_a?(c) }
119
119
 
120
- if @body.class.is_a?(Hash)
121
- raise InvalidBody, "must be one of: #{valid_types}, but you've used a #{@body.class}' instead." \
122
- "\n What shall we encode it to? try calling .to_json .to_xml instead on the hash instead, or otherwise convert it to a string."
120
+ if @body.is_a?(Hash)
121
+ raise InvalidBody, "must be one of: #{valid_types}, but you've used a #{@body.class}. " \
122
+ "Please convert it by calling .to_json .to_xml, or otherwise convert it to a string."
123
123
  else
124
- raise InvalidBody, "must be one of: #{valid_types}. '#{@body.class}' given"
124
+ raise InvalidBody, "must be one of: #{valid_types}. '#{@body.class}' given."
125
125
  end
126
126
  end
127
127
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebMock
4
- VERSION = '3.21.1' unless defined?(::WebMock::VERSION)
4
+ VERSION = '3.21.2' unless defined?(::WebMock::VERSION)
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.21.1
4
+ version: 3.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Blimke
@@ -371,9 +371,9 @@ licenses:
371
371
  - MIT
372
372
  metadata:
373
373
  bug_tracker_uri: https://github.com/bblimke/webmock/issues
374
- changelog_uri: https://github.com/bblimke/webmock/blob/v3.21.1/CHANGELOG.md
375
- documentation_uri: https://www.rubydoc.info/gems/webmock/3.21.1
376
- source_code_uri: https://github.com/bblimke/webmock/tree/v3.21.1
374
+ changelog_uri: https://github.com/bblimke/webmock/blob/v3.21.2/CHANGELOG.md
375
+ documentation_uri: https://www.rubydoc.info/gems/webmock/3.21.2
376
+ source_code_uri: https://github.com/bblimke/webmock/tree/v3.21.2
377
377
  wiki_uri: https://github.com/bblimke/webmock/wiki
378
378
  post_install_message:
379
379
  rdoc_options: []