bodyOf

fun bodyOf(blob: Blob): RequestBody(source)
fun bodyOf(buffer: ArrayBuffer, contentType: String = "application/octet-stream"): RequestBody(source)
fun bodyOf(bytes: ByteArray, contentType: String = "application/octet-stream"): RequestBody(source)
fun bodyOf(formData: FormData): RequestBody(source)
fun bodyOf(params: URLSearchParams): RequestBody(source)


fun bodyOf(text: String, contentType: String = "text/plain"): RequestBody(source)

Create a text body.

If you want to send json, consider using bodyOf that takes a Json parameter instead.

Parameters

contentType

The specific content type of the text, which defaults to "text/plain" if not specified. You do NOT have to add a charset to your type if it is just default UTF-8. In that case, it will be automatically appended for you.