Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard

Default HttpRequest implementation.

Link copied to clipboard
interface HttpRequest : HttpMessage, CoroutineScope

A request for HttpClient, first part of HttpClientCall.

Link copied to clipboard

Contains parameters used to make an HTTP request.

Link copied to clipboard
class HttpRequestData constructor(val url: Url, val method: HttpMethod, val headers: Headers, val body: OutgoingContent, val executionContext: Job, val attributes: Attributes)

Actual data of the HttpRequest, including url, method, headers, body and executionContext. Built by HttpRequestBuilder.

Link copied to clipboard
class HttpRequestPipeline(val developmentMode: Boolean = false) : Pipeline<Any, HttpRequestBuilder>

An HttpClient's pipeline used for executing HttpRequest.

Link copied to clipboard
class HttpResponseData(val statusCode: HttpStatusCode, val requestTime: GMTDate, val headers: Headers, val version: HttpProtocolVersion, val body: Any, val callContext: CoroutineContext)

Data prepared for HttpResponse.

Link copied to clipboard
class HttpSendPipeline(val developmentMode: Boolean = false) : Pipeline<Any, HttpRequestBuilder>

An HttpClient's pipeline used for sending HttpRequest to a remote server.

Functions

Link copied to clipboard

Appends the Accept header with a specific contentType.

Link copied to clipboard
fun HttpMessageBuilder.basicAuth(username: String, password: String)

Appends the HttpHeaders.Authorization to Basic Authorization with the provided username and password. For advanced configuration use the io.ktor:ktor-client-auth plugin.

Link copied to clipboard

Appends the HttpHeaders.Authorization to Bearer Authorization with the provided token. For advanced configuration use the io.ktor:ktor-client-auth plugin.

Link copied to clipboard
fun HttpMessageBuilder.cookie(name: String, value: String, maxAge: Int = 0, expires: GMTDate? = null, domain: String? = null, path: String? = null, secure: Boolean = false, httpOnly: Boolean = false, extensions: Map<String, String?> = emptyMap())

Appends a single header of key with a specific value if the value is not null.

Link copied to clipboard
inline suspend fun HttpClient.delete(builder: HttpRequestBuilder): HttpResponse

Executes a HttpClient DELETE request with the parameters configured in builder.

inline suspend fun HttpClient.delete(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's DELETE request with the parameters configured in block.

inline suspend fun HttpClient.delete(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes a HttpClient HEAD request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.delete(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's DELETE request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard
inline suspend fun HttpClient.get(builder: HttpRequestBuilder): HttpResponse

Executes an HttpClient's GET request with the parameters configured in builder.

inline suspend fun HttpClient.get(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's GET request with the parameters configured in block.

inline suspend fun HttpClient.get(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes a HttpClient GET request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.get(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's GET request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard
inline suspend fun HttpClient.head(builder: HttpRequestBuilder): HttpResponse

Executes a HttpClient HEAD request with the parameters configured in builder.

inline suspend fun HttpClient.head(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's HEAD request with the parameters configured in block.

inline suspend fun HttpClient.head(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes a HttpClient HEAD request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.head(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's HEAD request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard
fun HttpMessageBuilder.header(key: String, value: Any?)

Appends a single header of key with a specific value if the value is not null.

Link copied to clipboard

Executes a block that configures the HeadersBuilder associated to this request.

Link copied to clipboard

Executes a block that configures the URLBuilder associated to this request.

operator fun HttpRequestBuilder.Companion.invoke(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, block: URLBuilder.() -> Unit = {}): HttpRequestBuilder

Constructs a HttpRequestBuilder from URL information: scheme, host, port and path and optionally further configures it using block. Pass null to keep the existing value in the URLBuilder.

Link copied to clipboard
Link copied to clipboard
inline suspend fun HttpClient.options(builder: HttpRequestBuilder): HttpResponse

Executes a HttpClient OPTIONS request with the parameters configured in builder.

inline suspend fun HttpClient.options(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's OPTIONS request with the parameters configured in block.

inline suspend fun HttpClient.options(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes a HttpClient OPTIONS request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.options(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's OPTIONS request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Appends a single URL query parameter of key with a specific value if the value is not null. Can not be used to set form parameters in the body.

Link copied to clipboard
inline suspend fun HttpClient.patch(builder: HttpRequestBuilder): HttpResponse

Executes a HttpClient PATCH request with the parameters configured in builder.

inline suspend fun HttpClient.patch(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's PATCH request with the parameters configured in block.

inline suspend fun HttpClient.patch(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes a HttpClient PATCH request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.patch(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's PATCH request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard
inline suspend fun HttpClient.post(builder: HttpRequestBuilder): HttpResponse

Executes an HttpClient's POST request with the parameters configured in builder.

inline suspend fun HttpClient.post(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's POST request with the parameters configured in block.

inline suspend fun HttpClient.post(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes a HttpClient POST request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.post(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's POST request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Prepares an HttpClient's DELETE request with the parameters configured in builder.

Prepares an HttpClient's DELETE request with the parameters configured in block.

inline suspend fun HttpClient.prepareDelete(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares a HttpClient HEAD request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.prepareDelete(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's DELETE request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Prepares an HttpClient's GET request with the parameters configured in builder.

inline suspend fun HttpClient.prepareGet(block: HttpRequestBuilder.() -> Unit): HttpStatement

Prepares an HttpClient's GET request with the parameters configured in block.

inline suspend fun HttpClient.prepareGet(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares a HttpClient GET request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.prepareGet(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's GET request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Prepares an HttpClient's HEAD request with the parameters configured in builder.

inline suspend fun HttpClient.prepareHead(block: HttpRequestBuilder.() -> Unit): HttpStatement

Prepares an HttpClient's HEAD request with the parameters configured in block.

inline suspend fun HttpClient.prepareHead(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares a HttpClient HEAD request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.prepareHead(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's HEAD request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Prepares an HttpClient's OPTIONS request with the parameters configured in builder.

Prepares an HttpClient's OPTIONS request with the parameters configured in block.

inline suspend fun HttpClient.prepareOptions(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares a HttpClient OPTIONS request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.prepareOptions(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's OPTIONS request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Prepares an HttpClient's PATCH request with the parameters configured in builder.

inline suspend fun HttpClient.preparePatch(block: HttpRequestBuilder.() -> Unit): HttpStatement

Prepares an HttpClient's PATCH request with the parameters configured in block.

inline suspend fun HttpClient.preparePatch(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares a HttpClient PATCH request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.preparePatch(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's PATCH request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Prepares an HttpClient's POST request with the parameters configured in builder.

inline suspend fun HttpClient.preparePost(block: HttpRequestBuilder.() -> Unit): HttpStatement

Prepares an HttpClient's POST request with the parameters configured in block.

inline suspend fun HttpClient.preparePost(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares a HttpClient POST request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.preparePost(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's POST request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Prepares an HttpClient's PUT request with the parameters configured in builder.

inline suspend fun HttpClient.preparePut(block: HttpRequestBuilder.() -> Unit): HttpStatement

Prepares an HttpClient's PUT request with the parameters configured in block.

inline suspend fun HttpClient.preparePut(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares a HttpClient PUT request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.preparePut(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's PUT request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard
inline suspend fun HttpClient.prepareRequest(builder: HttpRequestBuilder = HttpRequestBuilder()): HttpStatement

Prepares an HttpClient's request with the parameters specified using builder.

Prepares an HttpClient's request with the parameters specified using block.

inline suspend fun HttpClient.prepareRequest(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's request with the url and the parameters configured in block.

inline suspend fun HttpClient.prepareRequest(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepares an HttpClient's request with the urlString and the parameters configured in 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.

Link copied to clipboard
inline suspend fun HttpClient.put(builder: HttpRequestBuilder): HttpResponse

Executes a HttpClient PUT request with the parameters configured in builder.

inline suspend fun HttpClient.put(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's PUT request with the parameters configured in block.

inline suspend fun HttpClient.put(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes a HttpClient PUT request with the specified url and an optional block receiving an HttpRequestBuilder for configuring the request.

inline suspend fun HttpClient.put(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's PUT request with the specified url and an optional block receiving an HttpRequestBuilder for 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.

Link copied to clipboard

Creates an HttpRequestBuilder and configures it using block.

inline suspend fun HttpClient.request(builder: HttpRequestBuilder = HttpRequestBuilder()): HttpResponse

Executes an HttpClient's request with the parameters specified using builder.

inline suspend fun HttpClient.request(block: HttpRequestBuilder.() -> Unit): HttpResponse

Executes an HttpClient's request with the parameters specified in block.

inline suspend fun HttpClient.request(url: Url, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's request with the url and the parameters configured in block.

inline suspend fun HttpClient.request(urlString: String, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Executes an HttpClient's request with the urlString and the parameters configured in 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.

Link copied to clipboard
inline fun <T> HttpRequestBuilder.setBody(body: T)
fun HttpRequestBuilder.setBody(body: Any?, bodyType: TypeInfo)
Link copied to clipboard

Mutates this copying all the data from another request using it as base.

Link copied to clipboard

Executes a block that configures the URLBuilder associated to this request.

fun HttpRequestBuilder.url(urlString: String)
fun HttpRequestBuilder.url(scheme: String? = null, host: String? = null, port: Int? = null, path: String? = null, block: URLBuilder.() -> Unit = {})

Sets the url using the specified scheme, host, port and path. Pass null to keep the existing value in the URLBuilder.

Properties

Link copied to clipboard

Gets the associated URL's host.

Link copied to clipboard

Gets the associated URL's port.