-
Fix
get_filewith Patron 1.1 (#1147)Previously, with Patron 1.1,
get_fileignored stubs: it made a real request and wrote the real response to the file, even when real connections were disabled.With Patron 1.1, a stubbed
get_filereturns a response with anilbody, as Patron does. Read the body from the file.Thanks to Bob Aman
-
Stub and block streamed requests with Patron 1.1 (#1147)
Previously, WebMock did not see requests made with
Session#streamor theget_stream,post_stream,put_streamandpatch_streammethods added in Patron 1.1, so they always reached the network.A stubbed streamed request yields a stream that reads the stubbed body, and returns a
Patron::TransferStats. After-request callbacks run before the block, so they also run when the block exits early. For a real streamed request, callbacks receive the status and headers without the body.Thanks to Bob Aman
-
Fix Patron digest authentication when real requests are allowed
Previously, when a Patron session had a username and password and a request reached the network, WebMock added an
Authorization: Basic ...header to it. A session withauth_type: :digestsent the password in that header instead of waiting for the server's digest challenge. -
Fix a deprecation warning with Patron 1.0 and later (#1142)
Previously, the first stubbed request printed
Patron::Response.new with positional arguments is deprecated.Thanks to Julik Tarkhanov
-
Fix
require "webmock"failing next to other libraries that defineHTTP::VERSION(#1139)Previously, WebMock loaded its adapter for the
httpgem whenever a top-levelHTTPwith aVERSIONwas defined. Other libraries define one too, such as the gem published on RubyGems ashttp.rb(a different gem fromhttp, which is also called http.rb). With such a library installed,require "webmock"raisedNameError: undefined method 'perform' for class 'HTTP::Client'.Thanks to thoran
-
Fix matching of indexed params with more than ten entries (#1141)
Previously, WebMock ordered indexed params such as
a[0]toa[10]as text, soa[10]came right aftera[1]. A stub with the values in index order, such aswith(body: {"a" => [...]}), did not match a form body with more than ten indexed values, or a query with more than ten indexed hashes.If a stub lists such values in the old order, for example one copied from WebMock's suggested stub, put them in index order.
Thanks to Andrii Furmanets