KtorPorthole

Ktor client integration, for apps not on the OkHttp engine.

An app using Ktor with the OkHttp engine can install the OkHttp porthole on that engine's client instead and get more: OkHttp exposes the whole call lifecycle, so DNS, connect and TLS show up as phases. This plugin sits above the engine, where the only honest boundary is "the call started" and "the call finished", so that is what it reports.

HttpClient(CIO) {
install(KtorPorthole.plugin)
}

Response bodies are deliberately not captured. Ktor hands the body over as a channel the caller is expected to consume exactly once, and a tee that gets it wrong breaks the app being debugged — which is a far worse outcome than a missing preview. Request bodies are captured when they are already in memory.

Properties

Link copied to clipboard
val plugin: ClientPlugin<Unit>

The plugin to install. Prefer portholeKtor, which reads better at the call site: