Package io.ktor.client.request.forms

Types

Link copied to clipboard
class ChannelProvider(size: Long?, block: () -> ByteReadChannel)

Supplies a new ByteReadChannel

Link copied to clipboard
class FormBuilder

Form builder type used in formData builder function.

Link copied to clipboard
class FormDataContent(formData: Parameters) : OutgoingContent.ByteArrayContent

OutgoingContent with for application/x-www-form-urlencoded formatted request.

Link copied to clipboard
data class FormPart<T : Any>(key: String, value: T, headers: Headers)

Multipart form item. Use it to build form in client.

Link copied to clipboard
class InputProvider(size: Long?, block: () -> Input)

Reusable Input form entry.

Link copied to clipboard
class MultiPartFormDataContent(parts: List<PartData>, boundary: String, contentType: ContentType) : OutgoingContent.WriteChannelContent

OutgoingContent for multipart/form-data formatted request.

Functions

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.

Link copied to clipboard
fun formData(vararg values: FormPart<*>): List<PartData>

Build multipart form from values.

fun formData(block: FormBuilder.() -> Unit): List<PartData>

Build multipart form using block function.

Link copied to clipboard
inline suspend fun HttpClient.prepareForm(formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement
suspend fun HttpClient.prepareForm(url: String, formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepare formParameters request.

Link copied to clipboard
inline suspend fun HttpClient.prepareFormWithBinaryData(formData: List<PartData>, crossinline block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepare HttpMethod.Post request with formData encoded in body. formData encoded using multipart/form-data format. https://tools.ietf.org/html/rfc2045

inline suspend fun HttpClient.prepareFormWithBinaryData(url: String, formData: List<PartData>, crossinline block: HttpRequestBuilder.() -> Unit = {}): HttpStatement

Prepare HttpMethod.Post request with formData encoded in body. url destination formData encoded using multipart/form-data format.

Link copied to clipboard
inline suspend fun HttpClient.submitForm(formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse
suspend fun HttpClient.submitForm(url: String, formParameters: Parameters = Parameters.Empty, encodeInQuery: Boolean = false, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Submit formParameters request.

Link copied to clipboard
inline suspend fun HttpClient.submitFormWithBinaryData(formData: List<PartData>, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Send HttpMethod.Post request with formData encoded in body. formData encoded using multipart/form-data format. https://tools.ietf.org/html/rfc2045

inline suspend fun HttpClient.submitFormWithBinaryData(url: String, formData: List<PartData>, block: HttpRequestBuilder.() -> Unit = {}): HttpResponse

Send HttpMethod.Post request with formData encoded in body. url destination formData encoded using multipart/form-data format.