commonMain.com.seiko.imageloader.model.KtorRequestData.kt Maven / Gradle / Ivy
package com.seiko.imageloader.model
import io.ktor.http.HttpMethod
data class KtorRequestData(
val method: HttpMethod,
val headers: Map,
)
class KtorRequestDataBuilder internal constructor() {
var method: HttpMethod = HttpMethod.Get
private var headers: MutableMap = mutableMapOf()
fun headers(block: MutableMap.() -> Unit) {
headers.apply(block)
}
fun build(): KtorRequestData {
return KtorRequestData(
method = method,
headers = headers.toMap(),
)
}
}
fun KtorRequestData(block: KtorRequestDataBuilder.() -> Unit): KtorRequestData =
KtorRequestDataBuilder().apply(block).build()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy