KoryHttpClient

HTTP client wrapper for Kory, providing POST, GET, and streaming POST methods.

Create instances via KoryHttpClient.create with a KoryHttpClientConfig. The engine is discovered automatically from the classpath (e.g. via kory-ktor-cio) or can be specified explicitly in the config.

Samples

examples.kory

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val client: HttpClient

The underlying Ktor HttpClient.

Functions

Link copied to clipboard
suspend fun delete(path: String): KoryHttpResponse
Link copied to clipboard
suspend fun download(path: String, sink: Sink, onProgress: (bytesWritten: Long, totalBytes: Long?) -> Unit? = null): Long
Link copied to clipboard
suspend fun get(path: String, params: Map<String, Any?> = emptyMap()): KoryHttpResponse

Sends a GET request.

Link copied to clipboard
suspend fun post(path: String, body: String?): KoryHttpResponse

Sends a POST request with a string body.

Link copied to clipboard
suspend fun postMultipart(path: String, parts: List<KoryFormDataPart>, onProgress: (Float) -> Unit? = null): KoryHttpResponse
Link copied to clipboard
suspend fun <T> streamGet(path: String, block: suspend (KoryHttpStreamResponse) -> T): T
Link copied to clipboard
fun streamGetBytes(path: String, chunkSize: Int = DOWNLOAD_BUFFER_SIZE): Flow<ByteArray>
Link copied to clipboard
fun streamPost(path: String, body: String): Flow<String>

Sends a streaming POST request, emitting response lines as they arrive.