HttpTransport

Minimal HTTP GET client used by ModelDownloader. Kept small so apps can plug in their own stack (OkHttp, Ktor, a corporate proxy) and tests can use a fake server.

Implementations must call handle in the caller's coroutine context (no withContext around it), because the downloader emits progress from inside it.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun <T> get(url: String, headers: Map<String, String>, handle: suspend (HttpResponse) -> T): T

Performs a GET of url with headers (for example Range) and passes the response to handle. The response is only valid inside handle; it is closed when handle returns.