Package io.ktor.client.features
Types
class DefaultRequest Feature is used to set request default parameters. |
|
class |
|
class HttpCallValidator Response validator feature is used for validate response and handle response exceptions. |
|
Base interface representing a HttpClient feature. |
|
class HttpPlainText HttpClient feature that encodes String request bodies to TextContent and processes the response body as String. |
|
class HttpRedirect HttpClient feature that handles http redirect |
|
class HttpSend This is internal feature that is always installed. |
|
class HttpTimeout Client HTTP timeout feature. There are no default values, so default timeouts will be taken from engine configuration or considered as infinite time if engine doesn’t provide them. |
|
interface Sender This interface represents a request send pipeline interceptor chain |
|
class UserAgent Default user-agent feature for HttpClient. |
Exceptions
class ClientRequestException : ResponseException Bad client request exception. |
|
class HttpRequestTimeoutException : CancellationException This exception is thrown in case request timeout exceeded. |
|
class RedirectResponseException : ResponseException Unhandled redirect exception. |
|
open class ResponseException : IllegalStateException Base for default response exceptions. |
|
class SendCountExceedException : IllegalStateException Thrown when too many actual requests were sent during a client call. It could be caused by infinite or too long redirect sequence. Maximum number of requests is limited by HttpSend.maxSendCount |
|
class ServerResponseException : ResponseException Server error exception. |
Type Aliases
typealias |
|
Response exception handler method. |
|
typealias HttpSendInterceptor = suspend Sender.(HttpClientCall, HttpRequestBuilder) -> HttpClientCall HttpSend pipeline interceptor function |
|
typealias HttpSendInterceptorBackwardCompatible = suspend Sender.(HttpClientCall) -> HttpClientCall HttpSend pipeline interceptor function backward compatible with previous implementation. |
|
typealias ResponseValidator = suspend (response: HttpResponse) -> Unit Response validator method. |
Functions
fun HttpClientConfig<*>.BrowserUserAgent(): Unit Install UserAgent feature with browser-like user agent. |
|
fun HttpClientConfig<*>.Charsets( Configure client charsets. |
|
fun ConnectTimeoutException( This exception is thrown in case connect timeout exceeded. |
|
fun HttpClientConfig<*>.CurlUserAgent(): Unit Install UserAgent feature with browser-like user agent. |
|
fun HttpClientConfig<*>.HttpResponseValidator( Install HttpCallValidator with block configuration. |
|
fun SocketTimeoutException( This exception is thrown in case socket timeout (read or write) exceeded. |
|
fun HttpClientConfig<*>.addDefaultResponseValidation(): Unit Default response validation. Check the response status code in range (0..299). |
|
Convert long timeout in milliseconds to int value. To do that we need to consider HttpTimeout.INFINITE_TIMEOUT_MS as zero and convert timeout value to Int. |
|
Convert long timeout in milliseconds to long value. To do that we need to consider HttpTimeout.INFINITE_TIMEOUT_MS as zero and convert timeout value to Int. |
|
fun HttpClientConfig<*>.defaultRequest( Set request default parameters. |
|
fun HttpClient.defaultTransformers(): Unit Install default transformers. Usually installed by default so there is no need to use it unless you have disabled it via HttpClientConfig.useDefaultTransformers. |
|
fun <B : Any, F : Any> HttpClient.feature( Try to get a feature installed in this client. Returns |
|
fun HttpRequestBuilder.timeout( Adds timeout boundaries to the request. Requires HttpTimeout feature to be installed. |