class HttpClient : CoroutineScope
Asynchronous client to perform HTTP requests.
This is a generic implementation that uses a specific engine HttpClientEngine.
HttpClient(engine: HttpClientEngine, userConfig: HttpClientConfig<out HttpClientEngineConfig> = HttpClientConfig())
Asynchronous client to perform HTTP requests. |
val attributes: Attributes
Typed attributes used as a lightweight container for this client. |
|
val coroutineContext: <ERROR CLASS> |
|
val
Dispatcher handles io operations. |
|
val engine: HttpClientEngine
: HttpClientEngine for executing requests. |
|
val engineConfig: HttpClientEngineConfig
Client engine config. |
|
val receivePipeline: HttpReceivePipeline
Pipeline used for receiving request. |
|
val requestPipeline: HttpRequestPipeline
Pipeline used for processing all the requests sent by this client. |
|
val responsePipeline: HttpResponsePipeline
Pipeline used for processing all the responses sent by the server. |
|
val sendPipeline: HttpSendPipeline
Pipeline used for sending the request. |
fun close(): Unit
Closes the underlying engine. |
|
fun config(block: HttpClientConfig<*>.() -> Unit): HttpClient
Returns a new HttpClient copying this client configuration, and additionally configured by the block parameter. |
|
suspend fun
Creates a new HttpRequest from a request data and a specific client call. |
|
fun isSupported(capability: HttpClientEngineCapability<*>): Boolean
Check if the specified capability is supported by this client. |
|
fun toString(): String |
suspend fun HttpClient.cookies(url: Url): List<Cookie>
Gets all the cookies for the specified url for this HttpClient. suspend fun HttpClient.cookies(urlString: String): List<Cookie>
Gets all the cookies for the specified urlString for this HttpClient. |
|
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. |
|
suspend fun HttpClient.delete(builder: HttpRequestBuilder): HttpResponse
Executes a HttpClient DELETE request, with the information from the builder suspend fun HttpClient.delete(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient DELETE request, with the information from the builder suspend fun HttpClient.delete(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient DELETE request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.delete(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient HEAD request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.delete(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient HEAD request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
fun <B : Any, F : Any> HttpClient.feature(feature: HttpClientFeature<B, F>): F?
Try to get the feature installed in this client. Returns |
|
operator fun <B : Any, F : Any> HttpClient.get(feature: HttpClientFeature<B, F>): F
Find the feature installed in HttpClient. |
|
suspend fun HttpClient.get(builder: HttpRequestBuilder): HttpResponse
Executes a HttpClient GET request, with the information from the builder suspend fun HttpClient.get(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient GET request, with the information from the builder suspend fun HttpClient.get(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse suspend fun HttpClient.get(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient GET request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.get(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient GET request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.head(builder: HttpRequestBuilder): HttpResponse
Executes a HttpClient HEAD request, with the information from the builder suspend fun HttpClient.head(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient HEAD request, with the information from the builder suspend fun HttpClient.head(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse suspend fun HttpClient.head(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient HEAD request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.head(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient HEAD request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
fun CoroutineScope.mapEngineExceptions(input: ByteReadChannel, request: HttpRequestData): ByteReadChannel
Returns ByteReadChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException. fun CoroutineScope.mapEngineExceptions(output: ByteWriteChannel, request: HttpRequestData): ByteWriteChannel
Returns ByteWriteChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException. |
|
suspend fun HttpClient.options(builder: HttpRequestBuilder): HttpResponse
Executes a HttpClient OPTIONS request, with the information from the builder suspend fun HttpClient.options(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient OPTIONS request, with the information from the builder suspend fun HttpClient.options(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse suspend fun HttpClient.options(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient OPTIONS request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.options(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient OPTIONS request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.patch(builder: HttpRequestBuilder): HttpResponse
Executes a HttpClient PATCH request, with the information from the builder suspend fun HttpClient.patch(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient PATCH request, with the information from the builder suspend fun HttpClient.patch(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse suspend fun HttpClient.patch(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient PATCH request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.patch(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient PATCH request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.post(builder: HttpRequestBuilder): HttpResponse
Executes a HttpClient POST request, with the information from the builder suspend fun HttpClient.post(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient POST request, with the information from the builder suspend fun HttpClient.post(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse suspend fun HttpClient.post(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient POST request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.post(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient POST request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.prepareDelete(builder: HttpRequestBuilder): HttpStatement
Prepares a HttpClient DELETE request, with the information from the builder suspend fun HttpClient.prepareDelete(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient DELETE request, with the information from the builder suspend fun HttpClient.prepareDelete(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient DELETE request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.prepareDelete(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient HEAD request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.prepareDelete(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient HEAD request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.prepareForm(formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement suspend fun HttpClient.prepareForm(url: String, formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepare formParameters request. |
|
suspend fun HttpClient.prepareFormWithBinaryData(formData: List<PartData>, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepare HttpMethod.Post request with formData encoded in body. formData encoded using multipart/form-data format. https://tools.ietf.org/html/rfc2045 suspend fun HttpClient.prepareFormWithBinaryData(url: String, formData: List<PartData>, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepare HttpMethod.Post request with formData encoded in body. url destination formData encoded using multipart/form-data format. |
|
suspend fun HttpClient.prepareGet(builder: HttpRequestBuilder): HttpStatement
Prepares a HttpClient GET request, with the information from the builder suspend fun HttpClient.prepareGet(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient GET request, with the information from the builder suspend fun HttpClient.prepareGet(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement suspend fun HttpClient.prepareGet(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient GET request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.prepareGet(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient GET request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.prepareHead(builder: HttpRequestBuilder): HttpStatement
Prepares a HttpClient HEAD request, with the information from the builder suspend fun HttpClient.prepareHead(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient HEAD request, with the information from the builder suspend fun HttpClient.prepareHead(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement suspend fun HttpClient.prepareHead(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient HEAD request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.prepareHead(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient HEAD request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.prepareOptions(builder: HttpRequestBuilder): HttpStatement
Prepares a HttpClient OPTIONS request, with the information from the builder suspend fun HttpClient.prepareOptions(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient OPTIONS request, with the information from the builder suspend fun HttpClient.prepareOptions(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement suspend fun HttpClient.prepareOptions(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient OPTIONS request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.prepareOptions(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient OPTIONS request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.preparePatch(builder: HttpRequestBuilder): HttpStatement
Prepares a HttpClient PATCH request, with the information from the builder suspend fun HttpClient.preparePatch(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient PATCH request, with the information from the builder suspend fun HttpClient.preparePatch(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement suspend fun HttpClient.preparePatch(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient PATCH request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.preparePatch(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient PATCH request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.preparePost(builder: HttpRequestBuilder): HttpStatement
Prepares a HttpClient POST request, with the information from the builder suspend fun HttpClient.preparePost(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient POST request, with the information from the builder suspend fun HttpClient.preparePost(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement suspend fun HttpClient.preparePost(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient POST request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.preparePost(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient POST request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.preparePut(builder: HttpRequestBuilder): HttpStatement
Prepares a HttpClient PUT request, with the information from the builder suspend fun HttpClient.preparePut(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient PUT request, with the information from the builder suspend fun HttpClient.preparePut(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement suspend fun HttpClient.preparePut(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient PUT request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.preparePut(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient PUT request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.prepareRequest(builder: HttpRequestBuilder = HttpRequestBuilder()): HttpStatement
Prepares a HttpClient request, with the information from the builder suspend fun HttpClient.prepareRequest(block: HttpRequestBuilder.() -> Unit): HttpStatement
Prepares a HttpClient request, with the information configured in builder block suspend fun HttpClient.prepareRequest(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient request, with the urlString and the information configured in builder block suspend fun HttpClient.prepareRequest(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient request, with the url and the information configured in builder block suspend fun HttpClient.prepareRequest(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
Prepares a HttpClient request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.put(builder: HttpRequestBuilder): HttpResponse
Executes a HttpClient PUT request, with the information from the builder suspend fun HttpClient.put(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient PUT request, with the information from the builder suspend fun HttpClient.put(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse suspend fun HttpClient.put(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient PUT request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. suspend fun HttpClient.put(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient PUT request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.request(builder: HttpRequestBuilder = HttpRequestBuilder()): HttpResponse
Executes a HttpClient request, with the information from the builder suspend fun HttpClient.request(block: HttpRequestBuilder.() -> Unit): HttpResponse
Executes a HttpClient request, with the information configured in builder block suspend fun HttpClient.request(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient request, with the urlString and the information configured in builder block suspend fun HttpClient.request(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient request, with the url and the information configured in builder block suspend fun HttpClient.request(url: URL, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Executes a HttpClient request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
suspend fun HttpClient.submitForm(formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse suspend fun HttpClient.submitForm(url: String, formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Submit formParameters request. |
|
suspend fun HttpClient.submitFormWithBinaryData(formData: List<PartData>, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Send HttpMethod.Post request with formData encoded in body. formData encoded using multipart/form-data format. https://tools.ietf.org/html/rfc2045 suspend fun HttpClient.submitFormWithBinaryData(url: String, formData: List<PartData>, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
Send HttpMethod.Post request with formData encoded in body. url destination formData encoded using multipart/form-data format. |
|
suspend fun HttpClient.webSocket(request: HttpRequestBuilder.() -> Unit, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit suspend fun HttpClient.webSocket(method: HttpMethod = HttpMethod.Get, host: String = "localhost", port: Int = DEFAULT_PORT, path: String = "/", request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit suspend fun HttpClient.webSocket(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit
Open block with DefaultClientWebSocketSession. |
|
suspend fun HttpClient.webSocketSession(block: HttpRequestBuilder.() -> Unit): DefaultClientWebSocketSession suspend fun HttpClient.webSocketSession(method: HttpMethod = HttpMethod.Get, host: String = "localhost", port: Int = DEFAULT_PORT, path: String = "/", block: HttpRequestBuilder.() -> Unit = {}): DefaultClientWebSocketSession
|
|
suspend fun HttpClient.ws(method: HttpMethod = HttpMethod.Get, host: String = "localhost", port: Int = DEFAULT_PORT, path: String = "/", request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit suspend fun HttpClient.ws(request: HttpRequestBuilder.() -> Unit, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit suspend fun HttpClient.ws(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit
Open block with DefaultClientWebSocketSession. |
|
suspend fun HttpClient.wss(request: HttpRequestBuilder.() -> Unit, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit suspend fun HttpClient.wss(urlString: String, request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit suspend fun HttpClient.wss(method: HttpMethod = HttpMethod.Get, host: String = "localhost", port: Int = DEFAULT_PORT, path: String = "/", request: HttpRequestBuilder.() -> Unit = {}, block: suspend DefaultClientWebSocketSession.() -> Unit): Unit
Open block with secure DefaultClientWebSocketSession. |