RecordedRequest

class RecordedRequest(val connectionIndex: Int, val exchangeIndex: Int, val handshake: Handshake?, val handshakeServerNames: List<String>, val method: String, val target: String, val version: String, val url: HttpUrl, val headers: Headers, val body: ByteString?, val bodySize: Long, val chunkSizes: List<Int>?, val failure: IOException? = null)

An HTTP request that came into the mock web server.

Constructors

Link copied to clipboard
constructor(connectionIndex: Int, exchangeIndex: Int, handshake: Handshake?, handshakeServerNames: List<String>, method: String, target: String, version: String, url: HttpUrl, headers: Headers, body: ByteString?, bodySize: Long, chunkSizes: List<Int>?, failure: IOException? = null)

Properties

Link copied to clipboard

The body of this request, or null if it has none. This may be truncated.

Link copied to clipboard

The total size of the body of this request (before truncation).

Link copied to clipboard

The sizes of the chunks of this request's body, or null if the request's body was not encoded with chunked encoding.

Link copied to clipboard

The index of the socket connection that carried this request. If two recorded requests share a connection index, they also shared a socket connection.

Link copied to clipboard

The index of this exchange on its HTTP connection. A request is uniquely identified by the (connection index, exchange index) pair.

Link copied to clipboard
val failure: IOException? = null

The failure MockWebServer recorded when attempting to decode this request. If, for example, the inbound request was truncated, this exception will be non-null.

Link copied to clipboard

The TLS handshake of the connection that carried this request, or null if the request was received without TLS.

Link copied to clipboard

Returns the name of the server the client requested via the SNI (Server Name Indication) attribute in the TLS handshake. Unlike the rest of the HTTP exchange, this name is sent in cleartext and may be monitored or blocked by a proxy or other middlebox.

Link copied to clipboard

All headers.

Link copied to clipboard

A string like GET or POST.

Link copied to clipboard
Link copied to clipboard

The request target from the original HTTP request.

Link copied to clipboard

The request URL built using the request line, headers, and local host name.

Link copied to clipboard

A string like HTTP/1.1 or HTTP/2.

Functions

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