networkCaptureSink
Returns a NetworkCaptureSink that records the requests of an HTTP client that Lustro has no adapter for, in the registered NetworkDebugTab. Your adapter calls NetworkCaptureSink.beginRequest when the client sends a request, then NetworkCaptureSink.completeRequest with the response, or NetworkCaptureSink.failRequest:
val sink = lustro.networkCaptureSink()
val id = sink.beginRequest(url, "PROPFIND", headers, requestBody = null, contentType = null)
sink.completeRequest(id, CapturedResponse.Builder(207, durationMs).headers(responseHeaders).build())The transactions go through the same redaction, capture filter, and pause as OkHttp's. A request that the filter leaves out, or that starts while capture is paused, is not recorded, and the calls for it do nothing. Mock rules and the throttle are your adapter's to apply: NetworkCaptureSink.findMockRule returns the matching rule and counts a hit on it. A rule with a MockRule.failure fails the request with a connection error instead of answering it: report that with the NetworkCaptureSink.failRequest that takes the rule. No call throws.
When no network tab is registered, or in a build that start refuses to arm, the sink records nothing and finds no mock rule.