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

commonMain.com.seiko.imageloader.model.KtorRequestData.kt Maven / Gradle / Ivy

There is a newer version: 1.10.0
Show newest version
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