deps(ruby): bump webmock from 3.34.0 to 3.36.0 in /ruby in the bundler-dependencies group

Merged
DE
12d ago
+6-6

Bumps the bundler-dependencies group in /ruby with 1 update: webmock.

Updates webmock from 3.34.0 to 3.36.0

Release notes

Sourced from webmock's releases.

3.36.0

  • Fix matching of indexed arrays nested inside arrays of hashes (#1144)

    Previously, WebMock read indexed arrays nested inside an array of hashes, such as a[][b][0][c]=1, as hashes with "0", "1" keys. WebMock writes that form itself, so with(query: {"a" => [{"b" => [{"c" => "1"}]}]}) with a regexp URI did not match ?a[][b][][c]=1, and a Typhoeus request with that hash as its body did not match a stub with the same hash.

    If a stub uses the old shape, such as {"a" => [{"b" => {"0" => {"c" => "1"}}}]}, for example one copied from WebMock's suggested stub, use arrays instead.

    Thanks to Hamza Tarar

  • Fix matching of arrays of hashes that repeat a nested key

    Previously, WebMock put a nested key repeated under [] into the first hash of the array, so items[][address][city]=X&items[][address][city]=Y was read as one item with the city Y. A stub listing both items did not match, and a stub for X and Y also matched a request for Z and Y. Rails and Faraday encode arrays of nested hashes this way.

    Such keys now go into a new hash, as in Rack. If a stub lists such an array as one item, for example one copied from WebMock's suggested stub, list every item.

    Queries that mix a value and nested keys under the same name, such as a[][b]=1&a[][b][c]=2 or a[c]=1&a[c][]=2, no longer raise IndexError or join the values into one string.

  • Apply Net::HTTP response_body_encoding to stubbed response bodies (#1138)

    Previously, stubbed Net::HTTP responses ignored Net::HTTP#response_body_encoding= and Net::HTTPResponse#body_encoding=. A body stubbed as binary, for example from a raw response file, stayed ASCII-8BIT even with http.response_body_encoding = true and a Content-Type of text/plain; charset=utf-8.

    Stubbed bodies now get the encoding real responses get: with true, the charset from the Content-Type header or an HTML <meta> tag, and otherwise the encoding the setting names. Without the setting, a body keeps the encoding it was stubbed with.

    Thanks to Yang Bai

  • Give each stubbed Net::HTTP response its own copy of the body

    Previously, a stubbed Net::HTTP response returned the stubbed body string itself. A body stubbed with a frozen string, such as a literal in a file with # frozen_string_literal: true, made response.body.force_encoding("UTF-8") raise FrozenError, which a real response never does. Changing the body in place, for example with response.body << "!", changed it for later requests to the same stub too.

  • Keep the size of async-http responses to HEAD requests (#1143)

    async-http gives the size of a response to a HEAD request as response.body.length, not as a header. Previously, a response stubbed with stub_request(:head, url).to_return(headers: {"Content-Length" => "42"}) ignored the Content-Length: its body was nil over HTTP/1 and had a length of 0 over HTTP/2. A real response lost its size, with a nil body, when a WebMock.after_request callback was registered, for example while VCR was recording, and the recorded response had no Content-Length.

    A stubbed response now takes its size from the stubbed Content-Length, or from the stubbed body without one, as before. A real response keeps its size when a callback is registered, and the recorded response has it as its Content-Length.

    Thanks to Andrew K. Fader

  • Keep the URI query of HTTPClient requests that pass a query argument (#1145)

    Previously, WebMock dropped the query in the URI when an HTTPClient request also passed the query argument. HTTPClient.new.get("http://example.com/?a=1", {"b" => "2"}) requests /?a=1&b=2, but WebMock saw /?b=2, and with {} as the query argument it saw no query at all. A stub or a_request expectation could match a URL that was never requested.

    If a stub or expectation for such a request leaves out the query in the URI, add it, for example stub_request(:get, "http://example.com/?a=1&b=2"). Record VCR cassettes with such requests again.

    Thanks to AmeenKhan12345

3.35.0

  • Fix get_file with Patron 1.1 (#1147)

    Previously, with Patron 1.1, get_file ignored stubs: it made a real request and wrote the real response to the file, even when real connections were disabled.

... (truncated)

Changelog

Sourced from webmock's changelog.

3.36.0

  • Fix matching of indexed arrays nested inside arrays of hashes (#1144)

    Previously, WebMock read indexed arrays nested inside an array of hashes, such as a[][b][0][c]=1, as hashes with "0", "1" keys. WebMock writes that form itself, so with(query: {"a" => [{"b" => [{"c" => "1"}]}]}) with a regexp URI did not match ?a[][b][][c]=1, and a Typhoeus request with that hash as its body did not match a stub with the same hash.

    If a stub uses the old shape, such as {"a" => [{"b" => {"0" => {"c" => "1"}}}]}, for example one copied from WebMock's suggested stub, use arrays instead.

    Thanks to Hamza Tarar

  • Fix matching of arrays of hashes that repeat a nested key

    Previously, WebMock put a nested key repeated under [] into the first hash of the array, so items[][address][city]=X&items[][address][city]=Y was read as one item with the city Y. A stub listing both items did not match, and a stub for X and Y also matched a request for Z and Y. Rails and Faraday encode arrays of nested hashes this way.

    Such keys now go into a new hash, as in Rack. If a stub lists such an array as one item, for example one copied from WebMock's suggested stub, list every item.

    Queries that mix a value and nested keys under the same name, such as a[][b]=1&a[][b][c]=2 or a[c]=1&a[c][]=2, no longer raise IndexError or join the values into one string.

  • Apply Net::HTTP response_body_encoding to stubbed response bodies (#1138)

    Previously, stubbed Net::HTTP responses ignored Net::HTTP#response_body_encoding= and Net::HTTPResponse#body_encoding=. A body stubbed as binary, for example from a raw response file, stayed ASCII-8BIT even with http.response_body_encoding = true and a Content-Type of text/plain; charset=utf-8.

    Stubbed bodies now get the encoding real responses get: with true, the charset from the Content-Type header or an HTML <meta> tag, and otherwise the encoding the setting names. Without the setting, a body keeps the encoding it was stubbed with.

    Thanks to Yang Bai

  • Give each stubbed Net::HTTP response its own copy of the body

    Previously, a stubbed Net::HTTP response returned the stubbed body string itself. A body stubbed with a frozen string, such as a literal in a file with # frozen_string_literal: true, made response.body.force_encoding("UTF-8") raise FrozenError, which a real response never does. Changing the body in place, for example with response.body << "!", changed it for later requests to the same stub too.

  • Keep the size of async-http responses to HEAD requests (#1143)

    async-http gives the size of a response to a HEAD request as response.body.length, not as a header. Previously, a response stubbed with stub_request(:head, url).to_return(headers: {"Content-Length" => "42"}) ignored the Content-Length: its body was nil over HTTP/1 and had a length of 0 over HTTP/2. A real response lost its size, with a nil body, when a WebMock.after_request callback was registered, for example while VCR was recording, and the recorded response had no Content-Length.

    A stubbed response now takes its size from the stubbed Content-Length, or from the stubbed body without one, as before. A real response keeps its size when a callback is registered, and the recorded response has it as its Content-Length.

    Thanks to Andrew K. Fader

  • Keep the URI query of HTTPClient requests that pass a query argument (#1145)

    Previously, WebMock dropped the query in the URI when an HTTPClient request also passed the query argument. HTTPClient.new.get("http://example.com/?a=1", {"b" => "2"}) requests /?a=1&b=2, but WebMock saw /?b=2, and with {} as the query argument it saw no query at all. A stub or a_request expectation could match a URL that was never requested.

    If a stub or expectation for such a request leaves out the query in the URI, add it, for example stub_request(:get, "http://example.com/?a=1&b=2"). Record VCR cassettes with such requests again.

    Thanks to AmeenKhan12345

3.35.0

  • Fix get_file with Patron 1.1 (#1147)

... (truncated)

Commits
  • a9a6fc0 Version 3.36.0
  • 622fbf0 Tidy #1145 and document it
  • 4bd2170 Merge pull request #1145 from AmeenKhan12345/fix-httpclient-uri-query-dropped
  • 18c1092 Tidy #1143, keep the size of every real HEAD response
  • e06de88 Merge pull request #1143 from andrewfader/async-http-head-content-length
  • 27cd96f Tidy #1138, apply the encoding once and copy stubbed bodies
  • 14defa9 Merge pull request #1138 from ybai08/net-http-response-body-encoding
  • b55c6c8 Merge pull request #1146 from sporkmonger/net-http-start-host-name
  • 62bf051 Start a new hash when a nested key repeats under []
  • d8a27e9 Tidy #1144 and document it
  • 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 <dependency name> major version will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
  • @dependabot ignore <dependency name> minor version will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
  • @dependabot ignore <dependency name> will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
  • @dependabot unignore <dependency name> will remove all of the ignore conditions of the specified dependency
  • @dependabot unignore <dependency name> <ignore condition> will remove the ignore condition of the specified dependency and ignore conditions

Summary by cubic

Bumps webmock from 3.34.0 to 3.36.0 in the Ruby tests along with its transitive dependencies addressable and hashdiff.

This minor update includes several behavior fixes around query and body matching, Net::HTTP response encoding, and HTTPClient URI handling. Most notably:

  • Arrays of hashes with repeated nested keys now match as separate items (compatible with Rails/Faraday encoding); stubs that previously matched incorrectly may need to be updated.
  • Net::HTTP#response_body_encoding is now applied to stubbed response bodies.
  • Each stubbed Net::HTTP response gets its own copy of the body, preventing mutations from leaking across requests.
  • HTTPClient requests that pass a query argument no longer lose the query from the URI.

No changes to our test suite should be required unless stubs relied on the old query or body matching behavior.