Request

class Request

An HTTP request. Instances of this class are immutable if their body is null or itself immutable.

Constructors

Link copied to clipboard
constructor(url: HttpUrl, headers: Headers = headersOf(), method: String = "", body: RequestBody? = null)

Constructs a new request.

Types

Link copied to clipboard
open class Builder

Properties

Link copied to clipboard
@get:JvmName(name = "body")
val body: RequestBody?
Link copied to clipboard
@get:JvmName(name = "cacheControl")
val cacheControl: CacheControl

Returns the cache control directives for this response. This is never null, even if this response contains no Cache-Control header.

Link copied to clipboard
@get:JvmName(name = "cacheUrlOverride")
val cacheUrlOverride: HttpUrl?
Link copied to clipboard
@get:JvmName(name = "headers")
val headers: Headers
Link copied to clipboard
Link copied to clipboard
@get:JvmName(name = "method")
val method: String
Link copied to clipboard
@get:JvmName(name = "url")
val url: HttpUrl

Functions

Link copied to clipboard
fun header(name: String): String?
Link copied to clipboard
fun headers(name: String): List<String>
Link copied to clipboard
Link copied to clipboard
@JvmName(name = "reifiedTag")
inline fun <T : Any> tag(): T?

Returns the tag attached with T as a key, or null if no tag is attached with that key.

fun <T> tag(type: Class<out T>): T?
fun <T : Any> tag(type: KClass<T>): T?

Returns the tag attached with type as a key, or null if no tag is attached with that key.

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