KoogHttpClient

@ApiStatus.Experimental
interface KoogHttpClient(source)

Abstract interfaces defining a contract for HTTP client implementations. Provides methods for making HTTP POST requests and handling Server-Sent Events (SSE) streams.

Implementations are supposed to use a particular library or framework.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend fun post(path: String, request: String): String

Sends an HTTP POST request to the specified path with the provided request payload.

abstract suspend fun <T : Any, R : Any> post(path: String, request: T, requestBodyType: KClass<T>, responseType: KClass<R>): R

Sends an HTTP POST request to the specified path with the provided request payload. The type of the request body and the expected response must be explicitly specified using requestBodyType and responseType, respectively.

Link copied to clipboard
abstract fun <T : Any, R : Any> sse(path: String, request: T, requestBodyType: KClass<T>, dataFilter: (String?) -> Boolean = { true }, decodeStreamingResponse: (String) -> R, processStreamingChunk: (R) -> String?): Flow<String>

Initiates a Server-Sent Events (SSE) streaming operation over an HTTP POST request.