HttpClient

interface HttpClient

An HTTP client performs HTTP requests.

You may provide a custom implementation, or use the DefaultHttpClient one which relies on native APIs.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Fetches the resource from the given request.

Link copied to clipboard

Fetches the resource from the given request as a JSONObject.

Link copied to clipboard
suspend fun HttpClient.fetchString(request: HttpRequest, charset: Charset = Charsets.UTF_8): HttpTry<String>

Fetches the resource from the given request as a String.

Link copied to clipboard
suspend fun <T> HttpClient.fetchWithDecoder(request: HttpRequest, decoder: (HttpFetchResponse) -> T): HttpTry<T>

Fetches the resource from the given request before decoding it with the provided decoder.

Link copied to clipboard

Performs a HEAD request to retrieve only the response headers.

Link copied to clipboard
abstract suspend fun stream(request: HttpRequest): HttpTry<HttpStreamResponse>

Streams the resource from the given request.