commonMain.eu.codlab.http.InjectHeaderPluginConfig.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-http-client Show documentation
Show all versions of kotlin-http-client Show documentation
Kotlin Multiplatform HttpClient
The newest version!
package eu.codlab.http
import io.ktor.client.plugins.api.createClientPlugin
import io.ktor.client.request.HttpRequestBuilder
class InjectHeaderPluginConfig {
var onRequest: ((request: HttpRequestBuilder) -> Unit)? = null
}
internal val InjectHeaderPlugin = createClientPlugin(
"InjectHeaderPlugin",
::InjectHeaderPluginConfig
) {
val block = pluginConfig.onRequest
onRequest { request, _ ->
if (null != block) {
block(request)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy