FormBuilder

class FormBuilder

Form builder type used in formData builder function.

Functions

Link copied to clipboard
fun <T : Any> append(part: FormPart<T>)

Append a form part.

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

Append a pair key:value with optional headers.

fun append(key: String, value: ChannelProvider, headers: Headers = Headers.Empty)

Append a pair key:ChannelProvider with optional headers.

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

Append a pair key:InputProvider(block) with optional headers.

Extensions

Link copied to clipboard
inline fun FormBuilder.append(key: String, headers: Headers = Headers.Empty, size: Long? = null, crossinline bodyBuilder: BytePacketBuilder.() -> 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)

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