Repository navigation
Update dependency webmock to "~> 3.34.0" - #32
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
"~> 3.23.1"→"~> 3.34.0"Release Notes
bblimke/webmock (webmock)
v3.34.0Compare Source
Allow
with(query: :any)to match any query string (#1099)stub_request(:get, "www.example.com").with(query: :any)matches requests with any query string, or none. RSpec'sanythingworks the same way. Previously, this raisedNoMethodError, and you had to writewith(query: hash_including({})).Use a URL without query parameters when passing
query: :any. Otherwise, WebMock raisesArgumentError.Thanks to nightpool
Raise a clear
ArgumentErrorfor an unsupportedqueryoptionPreviously, a value such as
with(query: :all)raisedNoMethodError(undefined methodsplit). The new error lists the supported values.Show
anythingfor keys given without a value tohash_includingorhash_excludingoutside RSpecPreviously, with Minitest or Test::Unit, messages showed
#<WebMock::Matchers::AnyArgMatcher:0x...>, for example forwith(query: hash_including(:a)). RSpec's own matchers already showedanything.Provide
HTTP_HOSTtoto_rackapps when the client has not supplied a Host header (#1084)Previously, requests from some HTTP clients reached the Rack app without
HTTP_HOST. This caused host checks such as Sinatra'sHostAuthorizationto see an empty host.WebMock now fills in the host from the request URL, including the port when it is not the default. An explicit Host header is preserved.
Thanks to Benoit Tigeot
Fix Rack compatibility for
to_rackappsThe request environment now passes
Rack::Lint.SERVER_PORTandCONTENT_LENGTHare now strings. If your app or tests read them directly, use string comparisons, such asenv['SERVER_PORT'] == "80". The environment also includesSERVER_PROTOCOL.CONTENT_TYPEis omitted when the request has no content type. TheContent-Lengthheader is passed only asCONTENT_LENGTH, without an extraHTTP_CONTENT_LENGTHentry.Transfer-Encodingis removed because the body has already been decoded.Repeated header values are joined into one string. Header values and the body read from
rack.inputnow use binary (ASCII-8BIT) strings.v3.33.0Compare Source
Return
effective_urlas a String for stubbed Typhoeus responses (#869)Previously, this was an
Addressable::URI. If your code calls methods such aseffective_url.host, parse the returned string into a URI first.The URL keeps the request's port, query order and encoding. It follows curl's formatting: for example,
http://example.com:80becomeshttp://example.com:80/. Stubbed timeouts now provide aneffective_urltoo.Thanks to Tom Brammar
Fix incorrect removal of default ports from displayed URLs
WebMock could accidentally remove
:80or:443from a URL's path or query. For example, an error message could show/foo/barinstead of/foo:80/bar.Only the host's default port is now removed. This also works when the port is immediately followed by a query string, as in
http://example.com:80?a=b.Set
return_codeto:okfor completed stubbed Typhoeus requests (#736)return_codeis now:okandreturn_messageis now"No error"; both were previouslynil. This includes HTTP error responses such as 404::okmeans the transfer completed. Stubbed timeouts still return:operation_timedout.Thanks to Michael Spiz
Fix the raw headers returned by stubbed Typhoeus responses
The
response_headersstring now uses the stubbed HTTP status. For example, a 404 stub no longer reportsHTTP/1.1 200 OK.Stubs without headers now return an empty
headershash ({}) instead ofnil. Theirresponse_headerscontains the status line instead of beingnil.The raw headers use binary string encoding, matching real responses. For timeouts,
response_headersis now an empty string.v3.32.0Compare Source
Make a
Net::HTTPobject created while WebMock was enabled behave like any otherNet::HTTPobject afterWebMock.disable!(#1067)Such an object, like a connection cached by net-http-persistent or by Capybara with Selenium, used to raise
ArgumentErroronstartor a stubbed request, andWebMock::NetConnectNotAllowedErroron any other request, after WebMock was disabled. It now sends real requests until WebMock is enabled again.Thanks to Mike Taylor and James Rodovich
Connect again when a request is retried on a
Net::HTTPobject that WebMock started without connecting and whose first real connection failedSuch a retry used to raise
NoMethodError(undefined methodclosed?for nil). It now tries to connect again, and raises the connection error if that fails too.Drop the
Transfer-Encodingheader from stubbed async-http responses, as WebMock already does withContent-Length(#1044)A stub with a
Transfer-Encodingheader, such aschunked, used to fail with "Message contains both transfer encoding and content length". async-http sets both headers itself from the body, and its responses from real servers don't include them either.Thanks to Tim Mertens
Record requests made with curb's
http_patchas PATCH requests with their body (#1112)curb has
http_patchsince 1.0.8. WebMock recorded such a request as a GET, or as a POST afterpost_body=, so a PATCH stub never matched it.Thanks to Andy Williams
Record a curb request sent without a body as having none, even after an earlier
http_postorhttp_patchcall with a body on the sameCurl::EasyobjectFor example, after
c.http_post("a=1"),c.resetandc.http(:POST), the second request was recorded with the bodya=1, so a stub for that body matched it.v3.31.0Compare Source
Return the contents of a
FileorPathnamebody given toto_return_json, or returned by its body lambda, instead of encoding the object as a JSON string (#1119)The file is read and closed as it is for
to_return: when the stub is declared, or on each request when it comes from a lambda.Thanks to Alex
Match HTTP methods given as a string or in upper case, as in
stub_request("get", ...),a_request("GET", ...)orassert_requested("post", ...)(#821)Before, such a method never matched, so the stub never applied and negative expectations like
assert_not_requested("get", ...)always passed. A test that passed only because of this can now fail.The method of a request is now always a lower case Symbol too. A request made with an upper case method, as Typhoeus does with
method: :POST, now matches a:poststub, and callbacks andwithblocks see:post.Thanks to Euisan Kim
v3.30.0Compare Source
Allow narrowing an RSpec expectation on a stub with
with, as inexpect(stub).to have_been_requested.once.with(body: "abc")(#1128)The expectation counts only the requests that match both the stub and the conditions given to
with. The stub itself does not change.Thanks to Sébastien S.
Show the JSON body hint for expectations narrowed with
withtoo, and no longer show it when a block is given to the stub or expectation, since checking would mean calling the blockAllow a full URL with a path in
disable_net_connect!(allow: ...), as inallow: "https://github.com/mozilla/geckodriver/releases/latest"(#977)URLs are compared the same way as in stubs, so the default port, letter case in the host, and the order and encoding of query parameters don't matter. A URL without a path or query allows every path on that scheme, host and port; a trailing slash restricts requests to
/with no query string. Credentials in either URL are ignored.Thanks to Henry Blyth
v3.29.0Compare Source
Show a body diff for JSON requests whose content type has a
+jsonsuffix, such asapplication/vnd.api+json, and for the other content types WebMock already matches as JSON (#734)Thanks to Olivier Brisse
Ignore the case of JSON, XML and url-encoded content types when matching request bodies, and match bodies of any
+jsonor+xmlmedia type, such asimage/svg+xml, as JSON or XMLSuggest declaring a JSON body as a hash when a request fails to match only because the JSON is formatted differently (#649)
A body declared as a string must match the request body exactly, including key order and whitespace. When that is the only difference, the error for an unregistered request and the failure message of a request expectation now say so, and suggest
with(body: JSON.parse(json_string)). Matching JSON strings regardless of key order by default is planned for the next major version (#485).v3.28.0Compare Source
Fix
to_rackapps receiving arack.sessionthey did not set up (#985)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.sessionandrack.session.optionsunset, as a real server does. If your app needs a session, include session middleware in the app you pass toto_rack.RackResponse#sessionandRackResponse#session_optionshave been removed.Thanks to Jan Graichen
Fix crash when matching a hash body pattern against a JSON or XML request that has no body
Thanks to Chris
No longer warn about curb versions newer than the last one tested
Document regexp values in
hash_includingThanks to Christian Bruckmayer
Remove unused
RequestSignatureSnippet#request_paramsThanks to Daniel Pepper
v3.27.0Compare Source
Fix crash in async-http adapter when a request header has a nil value
Thanks to hikmetba-bit
The async-http adapter now matches stubs against raw request header values instead of values parsed by protocol-http, consistent with the other adapters
Add RSpec
hash_excludingsupport to body matchingThanks to Chris Gunther
Fix
hash_excludingignoring keys given without a value and regexp values, in both query and body matchingFix crash when matching a request that has more than one
Content-Typeheaderv3.26.4Compare Source
HTTPClientadapter async requests by @koic in #1131v3.26.3Compare Source
Confirm to work with curb 1.3.7
Thanks to Josch Bockler
Fix NameError in async-http adapter on protocol-http1 >= 0.40
Thanks to Leslie Hoare
v3.26.2Compare Source
Add support to parse http/2 request on curb adapter
Thanks to Christoph Rieß
CurbAdapter alias
codefromresponse_codeThanks to Christoph Rieß
Add HTTP.rb v6.0.0 compatibility to http_rb adapter
Thanks to Erik Berlin
v3.26.1Compare Source
Fix compatibility with recent async-http versions
Thanks to Mikhail Doronin
v3.26.0Compare Source
Support Addressable::URI in request patterns
Thanks to Alexey Zapparov
v3.25.2Compare Source
Return support for
em_http_requestThanks to Oleg
v3.25.1Compare Source
Fix FrozenError in Typhoeus streaming response body
Thanks to Patrick Jaberg
v3.25.0Compare Source
Resolve net-http adapter deprecation Ruby 3.4
Thanks to Earlopain
v3.24.0Compare Source
Ignore parsing errors when parsing invalid JSON or XML body to match against body pattern #1066
Thanks to Christian Schmidt
Added support for mocked HTTP::Connection#finished_request? method #1065
Thanks to Christian Schmidt
Detect if Patron is loaded by checking if Patron::Session constant is defined #1068
Thanks to Rodrigo Argumedo
Raising an ArgumentError when uri is passed as a Pathname object to stub_request or request expectation declaration.
Dropped support for em-http-request on Ruby 3.4. The current version of em-http-request (1.1.7) is incompatible with Ruby 3.4 due to an unresolved issue (igrigorik/em-http-request#365). Support for em-http-request will be re-enabled once the compatibility issue is resolved.
Thanks to Christian Schmidt
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.