FormBuilder

class FormBuilder

Form builder type used in formData builder function.

Functions

append

fun <T : Any> append(
    key: String,
    value: T,
    headers: Headers = Headers.Empty
): Unit
fun append(
    key: String,
    value: String,
    headers: Headers = Headers.Empty
): Unit
fun append(
    key: String,
    value: Number,
    headers: Headers = Headers.Empty
): Unit
fun append(
    key: String,
    value: ByteArray,
    headers: Headers = Headers.Empty
): Unit
fun append(
    key: String,
    value: InputProvider,
    headers: Headers = Headers.Empty
): Unit
fun append(
    key: String,
    value: ByteReadPacket,
    headers: Headers = Headers.Empty
): Unit
fun append(
    key: String,
    value: Input,
    headers: Headers = Headers.Empty
): Unit

Append a pair key:value with optional headers.

fun <T : Any> append(part: FormPart<T>): Unit

Append a form part.

appendInput

fun appendInput(
    key: String,
    headers: Headers = Headers.Empty,
    size: Long? = null,
    block: () -> Input
): Unit

Append a pair key:InputProviderblock with optional headers.

Extension Functions

append

fun FormBuilder.append(
    key: String,
    headers: Headers = Headers.Empty,
    size: Long? = null,
    bodyBuilder: BytePacketBuilder.() -> Unit
): Unit

Append a form part with the specified key using bodyBuilder for it’s body.

fun FormBuilder.append(
    key: String,
    filename: String,
    contentType: ContentType? = null,
    size: Long? = null,
    bodyBuilder: BytePacketBuilder.() -> Unit
): Unit

Append a form part with the specified key, filename and optional contentType using bodyBuilder for it’s body.