HttpResponse

data class HttpResponse(val url: URL, val statusCode: Int, val message: String, val headers: Map<String, List<String>>, val body: ByteArray? = null)

Represents the response data for an HTTP response

Parameters

url

The original URL of the request that returned this response

statusCode

The HTTP status code of the response.

message

The response message from java.net.HttpURLConnection if available.

headers

The HTTP response headers for this request

body

Optional body returned by the response

Constructors

Link copied to clipboard
constructor(url: URL, statusCode: Int, message: String, headers: Map<String, List<String>>, body: ByteArray? = null)

Properties

Link copied to clipboard
val body: ByteArray? = null
Link copied to clipboard
val etag: String?

Utility method to retrieve the etag from the headers field.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val url: URL

Functions

Link copied to clipboard
fun bodyText(fallbackCharset: Charset = Charsets.UTF_8): String?

Utility method to read the body as a String.

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