webmock 3.27.0 → 3.28.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f11e25e75b578b0d4ce7d2c98cf02b893872c9766d7b707a21fb79e0293963c
4
- data.tar.gz: 205c01525a5240686ca49c63be018e962db268173bcd68406aef76a5452cc96b
3
+ metadata.gz: 337d9a801a6b8cabda8c8d3646346e475d9ec46f15453301314b1575b5e6e1f6
4
+ data.tar.gz: c33b8a74b6fbd42807eb12bb2a385441f953abfb1112c63f8fc1249be0aea38d
5
5
  SHA512:
6
- metadata.gz: b10e29592ef2d90396ec90b2d5717584e942748eccebe200748609295be1111616b14c706c503ad54543f3ee90e54e0e06ddfd9860b3ed0e093cda225df714a4
7
- data.tar.gz: cc80e50037959e1b9ff6fa600eea3c309e57c3aa6083d40e11288aecc1e81ebf1115cf07c10fba310543a58161674c8b62e829c7e5eedb9dadb8e6e81e894263
6
+ metadata.gz: 6dad3e43360bf3a82ff3cb6ba1655884c6a0fa4de4767699cc1ce832da1eb1cfe6bf0f37082a1e6d4c80edd839925bb468fad5a75012eb786b6f31342ce510a5
7
+ data.tar.gz: bfbaecd774edb88c0c09de2c8079d05b0d94b197343684cdd426f66e6c24237d9ba7302373a32b3608a1ea59c902f766e9b28b8532671dedfb83e12b8474b4d3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ # 3.28.0
4
+
5
+ * Fix `to_rack` apps receiving a `rack.session` they did not set up (#985)
6
+
7
+ WebMock used to add a session hash to the Rack env, shared by every request to the same stub. This confused apps that check whether a session is present, such as Rails API-only apps, and carried session data over between requests. WebMock now leaves `rack.session` and `rack.session.options` unset, as a real server does. If your app needs a session, include session middleware in the app you pass to `to_rack`. `RackResponse#session` and `RackResponse#session_options` have been removed.
8
+
9
+ Thanks to [Jan Graichen](https://github.com/jgraichen)
10
+
11
+ * Fix crash when matching a hash body pattern against a JSON or XML request that has no body
12
+
13
+ Thanks to [Chris](https://github.com/ChrisJr404)
14
+
15
+ * No longer warn about curb versions newer than the last one tested
16
+
17
+ * Document regexp values in `hash_including`
18
+
19
+ Thanks to [Christian Bruckmayer](https://github.com/ChrisBr)
20
+
21
+ * Remove unused `RequestSignatureSnippet#request_params`
22
+
23
+ Thanks to [Daniel Pepper](https://github.com/dpep)
24
+
3
25
  # 3.27.0
4
26
 
5
27
  * Fix crash in async-http adapter when a request header has a nil value
data/README.md CHANGED
@@ -184,6 +184,12 @@ stub_request(:post, "www.example.com").
184
184
 
185
185
  RestClient.post('www.example.com', "data[a]=1&data[b]=five&x=1",
186
186
  :content_type => 'application/x-www-form-urlencoded') # ===> Success
187
+
188
+ stub_request(:post, "www.example.com").
189
+ with(body: hash_including(id: /\d/))
190
+
191
+ RestClient.post('www.example.com', "id=1",
192
+ :content_type => 'application/x-www-form-urlencoded') # ===> Success
187
193
  ```
188
194
 
189
195
  ### Matching request body against excluding partial hash.
@@ -438,6 +444,8 @@ stub_request(:get, "www.example.com").to_rack(MyRackApp)
438
444
  RestClient.post('www.example.com') # ===> "Hello"
439
445
  ```
440
446
 
447
+ WebMock does not set `rack.session` in the Rack env, just as a real server would not. If your app needs a session, include session middleware in the app you pass to `to_rack`.
448
+
441
449
  ### Raising errors
442
450
 
443
451
  #### Exception declared by class
@@ -13,7 +13,7 @@ if defined?(Curl)
13
13
  # in curb 1.3.0 through 1.3.5. Fixed in curb 1.3.6. See https://github.com/taf2/curb/issues/478
14
14
  unsupported_curb_versions += %w[1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5] if RUBY_VERSION < '2.7'
15
15
 
16
- WebMock::VersionChecker.new('Curb', Curl::CURB_VERSION, '0.7.16', '1.3.7', unsupported_curb_versions).check_version!
16
+ WebMock::VersionChecker.new('Curb', Curl::CURB_VERSION, '0.7.16', nil, unsupported_curb_versions).check_version!
17
17
 
18
18
  module WebMock
19
19
  module HttpLibAdapters
@@ -52,8 +52,6 @@ module WebMock
52
52
  end
53
53
  env['rack.url_scheme'] = uri.scheme
54
54
  env['rack.run_once'] = true
55
- env['rack.session'] = session
56
- env['rack.session.options'] = session_options
57
55
 
58
56
  headers.each do |k, v|
59
57
  env["HTTP_#{k.tr('-','_').upcase}"] = v
@@ -61,13 +59,5 @@ module WebMock
61
59
 
62
60
  env
63
61
  end
64
-
65
- def session
66
- @session ||= {}
67
- end
68
-
69
- def session_options
70
- @session_options ||= {}
71
- end
72
62
  end
73
63
  end
@@ -306,6 +306,8 @@ module WebMock
306
306
  private
307
307
 
308
308
  def body_as_hash(body, content_type)
309
+ return if body.nil?
310
+
309
311
  case body_format(content_type)
310
312
  when :json then
311
313
  WebMock::Util::Parsers::JSON.parse(body)
@@ -42,15 +42,6 @@ module WebMock
42
42
  diff.empty? ? "" : "Body diff:\n #{pretty_print_to_string(diff)}"
43
43
  end
44
44
 
45
- def request_params
46
- @request_params ||=
47
- if request_signature.json_headers?
48
- JSON.parse(request_signature.body)
49
- else
50
- ""
51
- end
52
- end
53
-
54
45
  def pretty_print_to_string(string_to_print)
55
46
  StringIO.open("".dup) do |stream|
56
47
  PP.pp(string_to_print, stream)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebMock
4
- VERSION = '3.27.0' unless defined?(::WebMock::VERSION)
4
+ VERSION = '3.28.0' unless defined?(::WebMock::VERSION)
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.27.0
4
+ version: 3.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Blimke
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-10-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: addressable
@@ -359,11 +358,10 @@ licenses:
359
358
  - MIT
360
359
  metadata:
361
360
  bug_tracker_uri: https://github.com/bblimke/webmock/issues
362
- changelog_uri: https://github.com/bblimke/webmock/blob/v3.27.0/CHANGELOG.md
363
- documentation_uri: https://www.rubydoc.info/gems/webmock/3.27.0
364
- source_code_uri: https://github.com/bblimke/webmock/tree/v3.27.0
361
+ changelog_uri: https://github.com/bblimke/webmock/blob/v3.28.0/CHANGELOG.md
362
+ documentation_uri: https://www.rubydoc.info/gems/webmock/3.28.0
363
+ source_code_uri: https://github.com/bblimke/webmock/tree/v3.28.0
365
364
  wiki_uri: https://github.com/bblimke/webmock/wiki
366
- post_install_message:
367
365
  rdoc_options: []
368
366
  require_paths:
369
367
  - lib
@@ -378,8 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
376
  - !ruby/object:Gem::Version
379
377
  version: '0'
380
378
  requirements: []
381
- rubygems_version: 3.5.16
382
- signing_key:
379
+ rubygems_version: 4.0.20
383
380
  specification_version: 4
384
381
  summary: Library for stubbing HTTP requests in Ruby.
385
382
  test_files: []