HttpClient
class HttpClient : CoroutineScope, Closeable
Asynchronous client to perform HTTP requests.
This is a generic implementation that uses a specific engine HttpClientEngine.
Constructors
HttpClient( Asynchronous client to perform HTTP requests. |
Properties
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. |
Functions
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( Check if the specified capability is supported by this client. |
|
fun toString(): String |
Extension Functions
suspend fun HttpClient. Constructs a HttpClientCall from this HttpClient and with the specified HttpRequestBuilder configured inside the block. suspend fun HttpClient. Constructs a HttpClientCall from this HttpClient and with the specified HTTP request builder. suspend fun HttpClient. suspend fun HttpClient. suspend fun HttpClient. Constructs a HttpClientCall from this HttpClient, an url and an optional block configuring a HttpRequestBuilder. |
|
suspend fun HttpClient.cookies(url: Url): List<Cookie> Gets all the cookies for the specified url for this HttpClient. suspend fun HttpClient.cookies( Gets all the cookies for the specified urlString for this HttpClient. |
|
fun CoroutineScope. fun CoroutineScope.decodeChunked( Start a chunked stream decoder coroutine |
|
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 <T> HttpClient.delete( Executes a HttpClient DELETE request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.delete( Executes a HttpClient DELETE request, with the specified scheme, host, port, path and body. And allows to further configure the request, using a block receiving an HttpRequestBuilder. suspend fun <T> HttpClient.delete( 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 <T> HttpClient.delete( 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 <T> HttpClient.delete( Executes a HttpClient HEAD request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
fun <TEngine : ApplicationEngine, TConfiguration : Configuration> CoroutineScope.embeddedServer( Creates an embedded server with the given factory, listening on host:port |
|
fun <B : Any, F : Any> HttpClient.feature( Try to get the feature installed in this client. Returns |
|
operator fun <B : Any, F : Any> HttpClient.get( Find the feature installed in HttpClient. |
|
suspend fun <T> HttpClient.get( Executes a HttpClient GET request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.get( Executes a HttpClient GET request, with the specified scheme, host, port, path and body. And allows to further configure the request, using a block receiving an HttpRequestBuilder. suspend fun <T> HttpClient.get( suspend fun <T> HttpClient.get( 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 <T> HttpClient.get( 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 <T> HttpClient.head( Executes a HttpClient HEAD request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.head( Executes a HttpClient HEAD request, with the specified scheme, host, port, path and body. And allows to further configure the request, using a block receiving an HttpRequestBuilder. suspend fun <T> HttpClient.head( suspend fun <T> HttpClient.head( 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 <T> HttpClient.head( 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.httpServer( Start an http server with settings invoking handler for every request |
|
fun CoroutineScope. Start an http server with settings invoking handler for every request |
|
fun CoroutineScope.mapEngineExceptions( Returns ByteReadChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException. fun CoroutineScope.mapEngineExceptions( Returns ByteWriteChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException. |
|
suspend fun <T> HttpClient.options( Executes a HttpClient OPTIONS request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.options( Executes a HttpClient OPTIONS request, with the specified scheme, host, port, path and body. And allows to further configure the request, using a block receiving an HttpRequestBuilder. suspend fun <T> HttpClient.options( suspend fun <T> HttpClient.options( 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 <T> HttpClient.options( Executes a HttpClient OPTIONS request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
fun CoroutineScope.parseMultipart( fun CoroutineScope.parseMultipart( fun CoroutineScope. Starts a multipart parser coroutine producing multipart events |
|
suspend fun <T> HttpClient.patch( Executes a HttpClient PATCH request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.patch( Executes a HttpClient PATCH request, with the specified scheme, host, port, path and body. And allows to further configure the request, using a block receiving an HttpRequestBuilder. suspend fun <T> HttpClient.patch( suspend fun <T> HttpClient.patch( 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 <T> HttpClient.patch( Executes a HttpClient PATCH request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
fun CoroutineScope.pinger( Launch pinger coroutine on CoroutineScope that is sending ping every specified period to outgoing channel, waiting for and verifying client’s pong frames. It is also handling timeout and sending timeout close frame fun CoroutineScope.pinger( Launch pinger coroutine on CoroutineScope that is sending ping every specified periodMillis to outgoing channel, waiting for and verifying client’s pong frames. It is also handling timeoutMillis and sending timeout close frame |
|
fun CoroutineScope.pinger( Launch pinger coroutine on CoroutineScope that is sending ping every specified period to outgoing channel, waiting for and verifying client’s pong frames. It is also handling timeout and sending timeout close frame |
|
fun CoroutineScope.ponger( Launch a ponger actor job on the CoroutineScope sending pongs to outgoing channel. It is acting for every client’s ping frame and replying with corresponding pong |
|
suspend fun <T> HttpClient.post( Executes a HttpClient POST request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.post( Executes a HttpClient POST request, with the specified scheme, host, port, path and body. And allows to further configure the request, using a block receiving an HttpRequestBuilder. suspend fun <T> HttpClient.post( suspend fun <T> HttpClient.post( 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 <T> HttpClient.post( 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 <T> HttpClient.put( Executes a HttpClient PUT request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.put( Executes a HttpClient PUT request, with the specified scheme, host, port, path and body. And allows to further configure the request, using a block receiving an HttpRequestBuilder. suspend fun <T> HttpClient.put( suspend fun <T> HttpClient.put( 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 <T> HttpClient.put( Executes a HttpClient PUT request, with the specified url as Url and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
fun CoroutineScope.reader( fun CoroutineScope.reader( |
|
suspend fun <T> HttpClient.request( Executes a HttpClient request, with the information from the builder and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.request( Executes a HttpClient request, with the information configured in builder block and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.request( Executes a HttpClient request, with the urlString and the information configured in builder block and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.request( Executes a HttpClient request, with the url and the information configured in builder block and tries to receive a specific type T, if fails, an exception is thrown. suspend fun <T> HttpClient.request( Executes a HttpClient request, with the specified url as URL and an optional block receiving an HttpRequestBuilder for further configuring the request. |
|
fun CoroutineScope. Start connection HTTP pipeline invoking handler for every request. Note that handler could be invoked multiple times concurrently due to HTTP pipeline nature |
|
fun CoroutineScope.startServerConnectionPipeline( Start connection HTTP pipeline invoking handler for every request. Note that handler could be invoked multiple times concurrently due to HTTP pipeline nature |
|
suspend fun <T> HttpClient.submitForm( suspend fun <T> HttpClient.submitForm( suspend fun <T> HttpClient.submitForm( Submit formParameters request. |
|
suspend fun <T> HttpClient.submitFormWithBinaryData( suspend fun <T> HttpClient.submitFormWithBinaryData( Send HttpMethod.Post request with formData encoded in body. formData encoded using multipart/form-data format. https://tools.ietf.org/html/rfc2045 suspend fun <T> HttpClient.submitFormWithBinaryData( Send HttpMethod.Post request with formData encoded in body. url destination formData encoded using multipart/form-data format. |
|
suspend fun HttpClient.webSocket( suspend fun HttpClient.webSocket( suspend fun HttpClient.webSocket( Open block with DefaultClientWebSocketSession. |
|
suspend fun HttpClient.webSocketRaw( Create raw ClientWebSocketSession: no ping-pong and other service messages are used. |
|
suspend fun HttpClient.webSocketRawSession( Create raw ClientWebSocketSession: no ping-pong and other service messages are used. |
|
suspend fun HttpClient.webSocketSession( suspend fun HttpClient.webSocketSession( |
|
fun CoroutineScope. Start multirange response writer coroutine |
|
fun CoroutineScope.writer( fun CoroutineScope.writer( |
|
suspend fun HttpClient. Open DefaultClientWebSocketSession. suspend fun HttpClient.ws( suspend fun HttpClient.ws( Open block with DefaultClientWebSocketSession. |
|
suspend fun HttpClient.wsRaw( Create raw ClientWebSocketSession: no ping-pong and other service messages are used. |
|
suspend fun HttpClient.wss( suspend fun HttpClient.wss( suspend fun HttpClient.wss( Open block with secure DefaultClientWebSocketSession. |
|
suspend fun HttpClient.wssRaw( Create secure raw ClientWebSocketSession: no ping-pong and other service messages are used. |