Scoop API

scoop:scoop.http.client:0.1.0

HttpClient

class HttpClient

source · line 12
public
public class HttpClient internal constructor(internal val state: ClientState) : AsyncCloseable

A reusable structured HTTP/1 and HTTP/2 client bound to one event loop and owner scope. Close it before leaving that scope; responses and streaming sessions have explicit lifetimes.

function withWebSocket

source · line 132
public
public suspend fun <T> withWebSocket(request: HttpWebSocketRequest, options: HttpWebSocketOptions = httpWebSocketOptions(), block: suspend (HttpWebSocketResult) -> T): T

Runs a block with the upgrade result and closes the session or rejection response on every exit.

function download

source · line 90
public
public suspend fun download(request: HttpRequest, destination: Path, options: HttpDownloadOptions = httpDownloadOptions()): HttpDownloadResult

Streams a successful response into a temporary file and atomically commits it to the explicit destination on completion.

function close

source · line 148
public
public override suspend fun close(): Unit

Cancels and awaits active calls, sessions, connections, and cleanup; closing from work that would await itself is rejected.

function withSse

source · line 115
public
public suspend fun <T> withSse(request: HttpRequest, options: HttpSseOptions = httpSseOptions(), block: suspend (HttpEventSource) -> T): T

Runs a block with an SSE source and closes it on every exit.

function resumeDownload

source · line 99
public
public suspend fun resumeDownload(request: HttpRequest, destination: Path, resume: HttpResumeOptions, options: HttpDownloadOptions = httpDownloadOptions()): HttpDownloadResult

Resumes an explicitly identified partial file using validation metadata, committing the final destination only after a complete response.