commonMain.io.ktor.client.plugins.api.ClientHook.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktor-client-core-jvm Show documentation
Show all versions of ktor-client-core-jvm Show documentation
Ktor is a framework for quickly creating web applications in Kotlin with minimal effort.
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.client.plugins.api
import io.ktor.client.*
import io.ktor.util.*
/**
* A hook that can be registered in [ClientPluginBuilder].
*/
@KtorDsl
public interface ClientHook {
/**
* Specifies how to install a hook into [client].
*/
public fun install(client: HttpClient, handler: HookHandler)
}
internal class HookHandler(private val hook: ClientHook, private val handler: T) {
fun install(client: HttpClient) {
hook.install(client, handler)
}
}