Body

abstract class Body : Closeable

The response content of an HTTP response.

Since

200.2.0

Types

Link copied to clipboard
abstract class Builder

A builder to create a Response.Body instance.

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun bytes(): ByteArray

Returns the content of this HTTP response as ByteArray. All content is read into memory. Note that the content is consumed calling this function, thus subsequent calls will fail with an exception.

Link copied to clipboard
abstract fun byteStream(): InputStream

Returns an InputStream that reads the content of this HTTP response. Note that the content is consumed when reading out the input stream, thus subsequent calls will fail with an exception.

Link copied to clipboard
abstract fun contentLength(): Long?

Returns the number of bytes that will be returned by bytes, or null if unknown.

Link copied to clipboard
abstract fun contentType(): String

Returns the actual content type of the returned content.

Link copied to clipboard
abstract fun peek(): InputStream

Returns a new InputStream that can read data from this HTTP response body without consuming it.

Link copied to clipboard
abstract fun string(): String

Returns the content of an HTTP Response as a string.

Inherited functions

Link copied to clipboard
abstract override fun close()