DefaultRequestBuilder

Configuration object for DefaultRequestBuilder plugin

Functions

Link copied to clipboard
fun setAttributes(block: Attributes.() -> Unit)

Sets attributes using block.

Link copied to clipboard
fun url(block: URLBuilder.() -> Unit)

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

fun url(urlString: String)
fun 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 existing value in the URLBuilder.

Properties

Link copied to clipboard
Link copied to clipboard
open override val headers: HeadersBuilder
Link copied to clipboard

Gets the associated URL's host.

Link copied to clipboard
var port: Int

Gets the associated URL's port.

Link copied to clipboard

Extensions

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
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.