HttpRequestBuilder

class HttpRequestBuilder : HttpMessageBuilder

Class for building HttpRequestData.

Constructors

Link copied to clipboard
fun HttpRequestBuilder()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun build(): HttpRequestData

Create immutable HttpRequestData

Link copied to clipboard
fun <T : Any> getCapabilityOrNull(key: HttpClientEngineCapability<T>): T?

Retrieve capability by key.

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

Set request specific attributes specified by block.

Link copied to clipboard
fun <T : Any> setCapability(key: HttpClientEngineCapability<T>, capability: T)

Set capability configuration.

Link copied to clipboard
fun takeFrom(builder: HttpRequestBuilder): HttpRequestBuilder

Mutates this copying all the data but execution context from another builder using it as base.

Link copied to clipboard
fun takeFromWithExecutionContext(builder: HttpRequestBuilder): HttpRequestBuilder

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

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

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

Properties

Link copied to clipboard
val attributes: Attributes

Call specific attributes.

Link copied to clipboard
var body: Any

The body for this request. Initially EmptyContent.

Link copied to clipboard
var bodyType: TypeInfo?

The KType of body for this request. Null for default types that don't need serialization.

Link copied to clipboard
var executionContext: Job

A deferred used to control the execution of this request.

Link copied to clipboard
open override val headers: HeadersBuilder

HeadersBuilder to configure the headers for this request.

Link copied to clipboard
var method: HttpMethod

HttpMethod used by this request. HttpMethod.Get by default.

Link copied to clipboard
val url: URLBuilder

URLBuilder to configure the URL for this request.

Extensions

Link copied to clipboard
var HttpRequestBuilder.expectSuccess: Boolean

Terminate HttpClient.receivePipeline if status code is not successful (>=300).

Link copied to clipboard
var HttpRequestBuilder.host: String

Gets the associated URL's host.

Link copied to clipboard
fun HttpRequestBuilder.onDownload(listener: ProgressListener?)

Registers listener to observe download progress.

Link copied to clipboard
fun HttpRequestBuilder.onUpload(listener: ProgressListener?)

Registers listener to observe upload progress.

Link copied to clipboard
fun HttpRequestBuilder.parameter(key: String, value: Any?)

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
var HttpRequestBuilder.port: Int

Gets the associated URL's port.

Link copied to clipboard
fun HttpRequestBuilder.retry(block: HttpRequestRetry.Configuration.() -> Unit)

Configures the HttpRequestRetry plugin on a per-request level.

Link copied to clipboard
inline fun <T> HttpRequestBuilder.setBody(body: T)
Link copied to clipboard
fun HttpRequestBuilder.takeFrom(request: HttpRequest): HttpRequestBuilder

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

fun HttpRequestBuilder.takeFrom(request: HttpRequestData): HttpRequestBuilder
Link copied to clipboard

Adds timeout boundaries to the request. Requires the HttpTimeout plugin to be installed.

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

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

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 existing value in the URLBuilder.

fun HttpRequestBuilder.url(urlString: String)
fun HttpRequestBuilder.url(url: Url)
fun HttpRequestBuilder.url(url: URL): URLBuilder