easy_mock_http 0.2.0
easy_mock_http: ^0.2.0 copied to clipboard
Transport-agnostic HTTP mocking for Flutter VM tests. Intercepts dart:io's HttpClient via HttpOverrides, so Dio, http, or any client is mocked with zero injection — stub with when, assert with verify.
0.2.0 #
- Replace
StubBuilderwithMockResult, returned directly by everywhen/expectverb.MockResult.verificationlazily verifies calls handled by that exact registration. - Preserve dynamic replies through the new
respondernamed argument. - Keep
mockHttp.verifyas the independent matcher-based verification API.
0.1.0 #
- Initial release:
mockHttp()with fluentwhen/expect/verifyverbs. - Intercepts
dart:ioHttpClientviaHttpOverrides— covers Dio,package:http, and any other VM transport with zero injection. - Request matching by method, URL (path, full URL, or RegExp), and subset
matchers for
body,headers, andquery(values may be flutter_test matchers). - Replies via
response/statusCode/responseHeaders, plusdelayfor slow responses anderrorfor transport failures;replyWithfor dynamic replies. - Records every request (
requests) and verifies sends withcalled/calledOnce/never.