I started with a rudimentary HTTP mocking lib (adding features as needed) inspired by nock, but using the existing ZnClient / ZnRequest / ZnResponse api for mocking.
Available at https://lolg.it/herby/znock
Atm the feature are very basic (no filtering, matching only by host and scheme), but there it is for the interested.
Znock default intercept
Znock default verify
The setUp starts and cleans the mocker; the test case sets up the expectation that GET https://foo.bar/api/v0/info will occur and defines the response; tearDown checks that that GET actually appeared and fails if not.
DNU w/ whitelisting is used to reply certain ZnClient messages to set up the expectation, ZnResponse class messages to create the response and ZnResponse messages to fill it further.
So you can
if you like it this way or
to allow both http and https; eventually
if you want it shorter; mocking multiple req/res pair should work (not tested), as in
ok: (ZnEntity textCRLF: ‘herby’).
Both must appear (in any order) for verify to be happy.