Response

data class Response(val request: Request, val code: Int, val message: String, val responseBody: ByteArray?, val headers: Map<String, List<String>>, val cookies: Map<String, String>, val error: Exception?, val time: Long, val redirects: Int)

Representation of an HTTP Response

Parameters

request

The Request that generated this response

code

The response code

message

The response message

responseBody

The response body

headers

The response headers

cookies

The response cookies

error

The error if any (null if no error)

time

The time it took to get the response (in milliseconds)

redirects

The number of redirects

Constructors

Link copied to clipboard
constructor(request: Request, code: Int, message: String, responseBody: ByteArray?, headers: Map<String, List<String>>, cookies: Map<String, String>, error: Exception?, time: Long, redirects: Int)

Properties

Link copied to clipboard
val code: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val time: Long

Functions

Link copied to clipboard
fun asJson(): JsonElement?

Get the response body as a JsonElement

Link copied to clipboard

Get the response body as a String

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

Checks if this response is equal to another object

Link copied to clipboard
open override fun hashCode(): Int

Gets the hash code of this response

Link copied to clipboard
open override fun toString(): String

Converts this response to a JSON String representation