RequestBody¶
[common]\ expect abstract class RequestBody
[jvm, nonJvm]\ actual abstract class RequestBody
Constructors¶
RequestBody | [jvm, nonJvm] fun RequestBody() [common] expect fun RequestBody() |
Types¶
Name | Summary |
---|---|
Companion | [common, jvm, nonJvm] [common] expect object Companion [jvm, nonJvm] actual object Companion |
Functions¶
Name | Summary |
---|---|
contentLength | [common] expect open 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. [jvm, nonJvm] [jvm, nonJvm] actual open fun contentLength(): Long |
contentType | [common] expect abstract fun contentType(): MediaType? Returns the Content-Type header for this body. [jvm, nonJvm] [jvm, nonJvm] actual abstract fun contentType(): MediaType? |
isDuplex | [common] expect 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. [jvm, nonJvm] [jvm, nonJvm] actual open fun isDuplex(): Boolean |
isOneShot | [common] expect open 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. [jvm, nonJvm] [jvm, nonJvm] actual open fun isOneShot(): Boolean |
writeTo | [common] expect abstract fun writeTo(sink: BufferedSink) Writes the content of this request to sink. [jvm, nonJvm] [jvm, nonJvm] actual abstract fun writeTo(sink: BufferedSink) |
Inheritors¶
Name |
---|
FormBody |
MultipartBody |
Extensions¶
Name | Summary |
---|---|
gzip | [jvm] @JvmStatic fun RequestBody.gzip(): RequestBody Returns a gzip version of the RequestBody, with compressed payload. This is not automatic as not all servers support gzip compressed requests. |