MultipartBody

An RFC 2387-compliant request body.

Types

Link copied to clipboard
class Builder @JvmOverloads constructor(boundary: String = UUID.randomUUID().toString())
Link copied to clipboard
object Companion
Link copied to clipboard
class Part

Properties

Link copied to clipboard
@get:JvmName(name = "boundary")
val boundary: String
Link copied to clipboard
@get:JvmName(name = "parts")
val parts: List<MultipartBody.Part>
Link copied to clipboard
@get:JvmName(name = "size")
val size: Int

The number of parts in this multipart body.

Link copied to clipboard
@get:JvmName(name = "type")
val type: MediaType

Functions

Link copied to clipboard
open override fun contentLength(): Long

Returns the number of bytes that will be written to sink in a call to writeTo, or -1 if that count is unknown.

Link copied to clipboard
open override fun contentType(): MediaType

A combination of type and boundaryByteString.

Link copied to clipboard

Returns a gzip version of the RequestBody, with compressed payload. This is not automatic as not all servers support gzip compressed requests.

Link copied to clipboard
open fun isDuplex(): Boolean

A duplex request body is special in how it is transmitted on the network and in the API contract between OkHttp and the application.

Link copied to clipboard
open override fun isOneShot(): Boolean

Returns true if this body expects at most one call to writeTo and can be transmitted at most once. This is typically used when writing the request body is destructive and it is not possible to recreate the request body after it has been sent.

Link copied to clipboard
Link copied to clipboard
open override fun writeTo(sink: BufferedSink)

Writes the content of this request to sink.