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 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
fun HttpRequestBuilder.accept(contentType: ContentType)

Sets the Accept header with a specific contentType.

Link copied to clipboard
fun HttpRequestBuilder.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())

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

Link copied to clipboard
var HttpRequestBuilder.expectSuccess: Boolean

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

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

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

Link copied to clipboard
fun HttpRequestBuilder.headers(block: HeadersBuilder.() -> Unit): HeadersBuilder

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

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?)

Sets 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.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 HttpTimeout feature 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 = "http", host: String = "localhost", port: Int = DEFAULT_PORT, path: String = "/", block: URLBuilder.() -> Unit = {})

Sets the url using the specified scheme, host, port and path.

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