Repository navigation
v0.5.0
Add Keyed mode
- Simple mode — one handler per route. Perfect for a single test (or a
sequential suite): register a handler, make the request, assert the calls.
This is also perfect for static endpoint that always returns the same result
in every test.
UseRegisterHandler,GetNCalls,GetCalls,ResetCalls. - Keyed mode — one route, many per-request buckets. Use this when you want to
run tests in parallel against the same route and return a different response
for different requests. Each request is routed to a bucket by a key you
derive from the request (e.g. a user id, a client id, a channel), so each
parallel test owns its own handler and its own recorded calls with no
cross-test interference. UseRegisterKeyedRoute+RegisterKeyedHandler,
GetNCallsByKey,GetCallsByKey,ResetCallsByKey.
| Simple mode (single test) | Keyed mode (parallel-safe) |
|---|---|
RegisterHandler |
RegisterKeyedRoute + RegisterKeyedHandler |
GetNCalls(method, path) |
GetNCallsByKey(method, path, key) |
GetCalls(method, path) |
GetCallsByKey(method, path, key) |
ResetCalls() (all buckets) |
ResetCallsByKey(method, path, key) |
Full Changelog: v0.4.0...v0.5.0