HttpResponse

data class HttpResponse(val request: HttpRequest, val url: AbsoluteUrl, val statusCode: HttpStatus, val headers: Map<String, List<String>>, val mediaType: MediaType?)

Represents a successful HTTP response received from a server.

Parameters

request

Request associated with the response.

url

Final URL of the response.

statusCode

Response status code.

headers

HTTP response headers, indexed by their name.

mediaType

Media type from the Content-Type header.

Constructors

Link copied to clipboard
constructor(request: HttpRequest, url: AbsoluteUrl, statusCode: HttpStatus, headers: Map<String, List<String>>, mediaType: MediaType?)

Properties

Link copied to clipboard

Indicates whether this server supports byte range requests.

Link copied to clipboard

The expected content length for this response, when known.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun header(name: String): String?

Finds the last header matching the given name. In keeping with the HTTP RFC, HTTP header field names are case-insensitive. The returned string can contain a single value or a comma-separated list of values if the field supports it.

Link copied to clipboard
fun headers(name: String): List<String>

Finds all the headers matching the given name. In keeping with the HTTP RFC, HTTP header field names are case-insensitive. Each item of the returned list can contain a single value or a comma-separated list of values if the field supports it.