Repository navigation
-
Add support for
Curl::Multi(#535)Previously, WebMock didn't see requests sent with
Curl::Multi. A handle added withmulti.addand sent withmulti.performwent to the real server, even when a stub matched it or real connections were disabled, and WebMock didn't record it.Now a handle that matches a stub gets the stubbed response during
multi.perform, and one that is neither stubbed nor allowed raisesWebMock::NetConnectNotAllowedErrorfrommulti.add. Allowed requests still run together in curb's own multi loop. WebMock records both, andWebMock.after_requestcallbacks get both.If your tests send
Curl::Multirequests to real servers, stub them or allow their hosts, for example withWebMock.disable_net_connect!(allow: "api.example.com"). VCR, hooked into WebMock, now records and replays these requests too, and raisesVCR::Errors::UnhandledHTTPRequestErrorfor one that a cassette doesn't have, so record such cassettes again.Thanks to Todd Fisher
-
Drop curb callbacks on
Curl::Easy#resetfor stubbed requests, as curb doesPreviously, a callback such as
on_complete, set beforereset, still ran for a stubbed request made after it. Curb drops every callback onreset, so a real request didn't run it. If your tests rely on such a callback, set it again afterreset.