Response

class Response(val body: ByteArray, val length: Int, val statusCode: Short, val headers: Map<String, String>)

Class representing an HTTP response.

Constructors

Link copied to clipboard
constructor(body: ByteArray, length: Int, statusCode: Short, headers: Map<String, String>)

Properties

Link copied to clipboard

The body of the response as a ByteArray.

Link copied to clipboard

The headers of the response as a Map where the key is the header name and the value is the header value.

Link copied to clipboard

Checks if the status code of the response is in the range 200..299, which indicates a successful response.

Link copied to clipboard
val length: Int

The length of the response body.

Link copied to clipboard

The status code of the response.

Link copied to clipboard

Converts the body of the response, which is a ByteArray, to a String (UTF-8). This is useful for cases where the response body is expected to be text.

Functions

Link copied to clipboard
inline fun <T> deserialize(): T

This function is used to deserialize the JSON response body into an object of type T. The function is inline and reified, which means it can safely use the generic type T at runtime.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int