All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.ktor.client.plugins.api.ClientHook.kt Maven / Gradle / Ivy

Go to download

Ktor is a framework for quickly creating web applications in Kotlin with minimal effort.

There is a newer version: 2.2.4
Show newest version
/*
 * 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)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy