Skip to content

build(deps-dev): bump webmock from 3.36.0 to 3.38.0 - #5704

Merged
philippthun merged 1 commit into
mainfrom
dependabot/bundler/webmock-3.38.0
Nov 26, 2026
Merged

philippthun merged 1 commit into
mainfrom
dependabot/bundler/webmock-3.38.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 25, 2026

Copy link
Copy Markdown
Contributor

Bumps webmock from 3.36.0 to 3.38.0.

Release notes

Sourced from webmock's releases.

3.38.0

  • Allow or disable real requests only within a block (#1110)

    WebMock.allow_net_connect! and WebMock.disable_net_connect! now take a block, for example WebMock.disable_net_connect!(allow: "api.example.com") { ... }. The settings apply only while the block runs. When it ends, even with an exception, the settings from before the call come back.

    Previously, either method ignored a block. In WebMock.allow_net_connect! { Net::HTTP.get(uri) }, the request never ran, and real requests stayed allowed until the settings changed again. Code in such a block now runs.

    The settings are global, so other threads see them while the block runs. Don't run such blocks in several threads at once, because they can restore each other's settings in the wrong order.

    Thanks to Yegor Bugayenko for the suggestion

  • Record the form Content-Type of Typhoeus requests with a hash body (#463)

    Previously, Typhoeus.post(url, body: {page: 2}) sent Content-Type: application/x-www-form-urlencoded, but WebMock recorded the request without it. A stub with with(body: {page: 2}) didn't match, and neither did a stub that required that header.

    WebMock now records the header whenever Typhoeus sends it for a hash body: for a POST, even with an empty hash, and for any other method except PUT and HEAD, unless the form is empty.

    A request that sets its own Content-Type keeps it. Multipart forms, such as a hash with a file or a request with multipart: true, still have no Content-Type recorded, except an empty POST, which Typhoeus sends URL encoded even then. Requests with nobody: true have none either.

    Callbacks, WebMock.executed_requests and VCR see the header too, and the stub suggested for an unmatched request includes it and shows a form body as a hash. Update assertions that compare all the headers of such a request. If VCR, hooked into WebMock, matches requests on their headers, record the affected cassettes again.

  • Keep a with block when with is called again with options only

    Previously, stub_request(:post, url).with { |request| request.body == "yes" }.with(headers: {"X-A" => "1"}) dropped the block, so the stub also matched a request with that header and the body "no". A later with call already kept the options it didn't give, such as body:, and now keeps the block too. The same applies to a_request.

    A stub or request expectation that matched only because the block was dropped no longer matches. Calling with again with a block, or with an option given before, still replaces it.

  • Match numbers and boolean values in query patterns (#371)

    Previously, with(query: hash_including(page: 2)) never matched ?page=2, because query values in a request are strings and WebMock compared them with the Integer 2. A plain hash had the same problem when the stub's URI was a regexp, a template or a lambda, as in stub_request(:get, /example/).with(query: {page: 2}). With a string URI, an array of numbers such as {tag: [2, 10]} didn't match ?tag[]=2&tag[]=10.

    WebMock now compares numbers, true and false in query patterns as strings, including inside nested hash_including and hash_excluding matchers.

    This also makes hash_excluding work with such values. Previously, with(query: hash_excluding(page: 2)) matched ?page=2. A test that passed only because of this will now fail.

  • Fix nested hash_including and hash_excluding with symbol keys in RSpec (#900)

    Previously, in RSpec, with(body: {user: hash_including(role: "admin")}) never matched the JSON body {"user":{"role":"admin"}}. WebMock converted the keys of the outer hash to strings, but not those of a matcher inside it, and the parsed body has string keys. For the same reason, a nested hash_excluding with symbol keys never excluded anything, so with(body: {user: hash_excluding(role: "admin")}) matched that body too.

    The same applied to query patterns: with(query: hash_including(filter: hash_excluding(role: "admin"))) matched ?filter[role]=admin.

    Nested matchers now get string keys too, as do hashes inside RSpec's array_including and array_excluding. A test that passed only because a nested hash_excluding excluded nothing will now fail.

  • Fix hash_including and hash_excluding nested in a query hash

    Previously, stub_request(:get, "www.example.com").with(query: {filter: hash_including("role" => "admin")}) never matched ?filter[role]=admin&filter[active]=true, because WebMock wrote the matcher into the stub's URL as text. With a regexp, a template or a lambda URI, such a stub never matched in RSpec, where hash_including and hash_excluding are RSpec's own matchers.

    Such stubs now match with every kind of URI.

  • Ignore letter case in allowed host names (#819)

... (truncated)

Changelog

Sourced from webmock's changelog.

3.38.0

  • Allow or disable real requests only within a block (#1110)

    WebMock.allow_net_connect! and WebMock.disable_net_connect! now take a block, for example WebMock.disable_net_connect!(allow: "api.example.com") { ... }. The settings apply only while the block runs. When it ends, even with an exception, the settings from before the call come back.

    Previously, either method ignored a block. In WebMock.allow_net_connect! { Net::HTTP.get(uri) }, the request never ran, and real requests stayed allowed until the settings changed again. Code in such a block now runs.

    The settings are global, so other threads see them while the block runs. Don't run such blocks in several threads at once, because they can restore each other's settings in the wrong order.

    Thanks to Yegor Bugayenko for the suggestion

  • Record the form Content-Type of Typhoeus requests with a hash body (#463)

    Previously, Typhoeus.post(url, body: {page: 2}) sent Content-Type: application/x-www-form-urlencoded, but WebMock recorded the request without it. A stub with with(body: {page: 2}) didn't match, and neither did a stub that required that header.

    WebMock now records the header whenever Typhoeus sends it for a hash body: for a POST, even with an empty hash, and for any other method except PUT and HEAD, unless the form is empty.

    A request that sets its own Content-Type keeps it. Multipart forms, such as a hash with a file or a request with multipart: true, still have no Content-Type recorded, except an empty POST, which Typhoeus sends URL encoded even then. Requests with nobody: true have none either.

    Callbacks, WebMock.executed_requests and VCR see the header too, and the stub suggested for an unmatched request includes it and shows a form body as a hash. Update assertions that compare all the headers of such a request. If VCR, hooked into WebMock, matches requests on their headers, record the affected cassettes again.

  • Keep a with block when with is called again with options only

    Previously, stub_request(:post, url).with { |request| request.body == "yes" }.with(headers: {"X-A" => "1"}) dropped the block, so the stub also matched a request with that header and the body "no". A later with call already kept the options it didn't give, such as body:, and now keeps the block too. The same applies to a_request.

    A stub or request expectation that matched only because the block was dropped no longer matches. Calling with again with a block, or with an option given before, still replaces it.

  • Match numbers and boolean values in query patterns (#371)

    Previously, with(query: hash_including(page: 2)) never matched ?page=2, because query values in a request are strings and WebMock compared them with the Integer 2. A plain hash had the same problem when the stub's URI was a regexp, a template or a lambda, as in stub_request(:get, /example/).with(query: {page: 2}). With a string URI, an array of numbers such as {tag: [2, 10]} didn't match ?tag[]=2&tag[]=10.

    WebMock now compares numbers, true and false in query patterns as strings, including inside nested hash_including and hash_excluding matchers.

    This also makes hash_excluding work with such values. Previously, with(query: hash_excluding(page: 2)) matched ?page=2. A test that passed only because of this will now fail.

  • Fix nested hash_including and hash_excluding with symbol keys in RSpec (#900)

    Previously, in RSpec, with(body: {user: hash_including(role: "admin")}) never matched the JSON body {"user":{"role":"admin"}}. WebMock converted the keys of the outer hash to strings, but not those of a matcher inside it, and the parsed body has string keys. For the same reason, a nested hash_excluding with symbol keys never excluded anything, so with(body: {user: hash_excluding(role: "admin")}) matched that body too.

    The same applied to query patterns: with(query: hash_including(filter: hash_excluding(role: "admin"))) matched ?filter[role]=admin.

    Nested matchers now get string keys too, as do hashes inside RSpec's array_including and array_excluding. A test that passed only because a nested hash_excluding excluded nothing will now fail.

  • Fix hash_including and hash_excluding nested in a query hash

    Previously, stub_request(:get, "www.example.com").with(query: {filter: hash_including("role" => "admin")}) never matched ?filter[role]=admin&filter[active]=true, because WebMock wrote the matcher into the stub's URL as text. With a regexp, a template or a lambda URI, such a stub never matched in RSpec, where hash_including and hash_excluding are RSpec's own matchers.

    Such stubs now match with every kind of URI.

... (truncated)

Commits
  • eacd7ca Version 3.38.0
  • 9751d30 Match flat_array query patterns given in any order
  • b3126b9 Record the Content-Type that libcurl sends for Typhoeus form bodies
  • 3c43eea Keep a with block when with is called again with options only
  • 07dfed7 Document matching repeated query params
  • e06ab1d Apply a changed query notation to URLs normalized before
  • b898a8b Fix Net::HTTP OPTIONS * requests raising InvalidURIError
  • 5484036 Ignore letter case in allowed host names
  • ff53696 Fix URI templates not matching encoded reserved characters in the query
  • f5f51cd Fix RSpec hash matchers with symbol keys nested in a body or query pattern
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [webmock](https://github.com/bblimke/webmock) from 3.36.0 to 3.38.0.
- [Release notes](https://github.com/bblimke/webmock/releases)
- [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md)
- [Commits](bblimke/webmock@v3.36.0...v3.38.0)

---
updated-dependencies:
- dependency-name: webmock
  dependency-version: 3.38.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code labels Nov 25, 2026
@philippthun
philippthun merged commit fe09500 into main Nov 26, 2026
12 checks passed
@philippthun
philippthun deleted the dependabot/bundler/webmock-3.38.0 branch November 26, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant