Skip to content

//okhttp/okhttp3/Request

Request

[common]\ expect class Request

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

[jvm, nonJvm]\ actual class Request

Constructors

Request [jvm]
fun Request(url: HttpUrl, headers: Headers = Headers.headersOf(), method: String = "", body: RequestBody? = null)
Constructs a new request.
Request [nonJvm]
fun Request(url: String, headers: Headers = Headers.headersOf(), method: String = "", body: RequestBody? = null)
Constructs a new request.

Types

Name Summary
Builder [common, jvm, nonJvm]
[common]
expect open class Builder
[jvm, nonJvm]
actual open class Builder

Functions

Name Summary
header [common, jvm, nonJvm]
[common]
expect fun header(name: String): String?
[jvm, nonJvm]
actual fun header(name: String): String?
headers [common, jvm, nonJvm]
[common]
expect fun headers(name: String): List<String>
[jvm, nonJvm]
actual fun headers(name: String): List<String>
newBuilder [common, jvm, nonJvm]
[common]
expect fun newBuilder(): Request.Builder
[jvm, nonJvm]
actual fun newBuilder(): Request.Builder
tag [common]
expect 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.
[jvm, nonJvm]
[jvm]
@JvmName(name = "reifiedTag")
actual inline fun <T : Any> tag(): T?
[nonJvm]
actual inline fun <T : Any> tag(): T?
[jvm, nonJvm]
actual fun <T : Any> tag(type: KClass<T>): T?
[jvm, common]
[jvm]
fun <T> tag(type: Class<out T>): T?
[common]
expect 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.
toString [jvm, nonJvm]
[jvm]
open override fun toString(): String
[nonJvm]
open override fun toString(): String

Properties

Name Summary
body [common]
expect val body: RequestBody?
[jvm]
@get:JvmName(name = "body")
actual val body: RequestBody?
[nonJvm]
actual val body: RequestBody?
cacheControl [common]
expect val cacheControl: CacheControl
Returns the cache control directives for this response. This is never null, even if this response contains no Cache-Control header.
[jvm]
@get:JvmName(name = "cacheControl")
actual val cacheControl: CacheControl
[nonJvm]
actual val cacheControl: CacheControl
headers [common]
expect val headers: Headers
[jvm]
@get:JvmName(name = "headers")
actual val headers: Headers
[nonJvm]
actual val headers: Headers
isHttps [common]
expect val isHttps: Boolean
[jvm, nonJvm]
actual val isHttps: Boolean
method [common]
expect val method: String
[jvm]
@get:JvmName(name = "method")
actual val method: String
[nonJvm]
actual val method: String
url [common]
expect val url: HttpUrlRepresentation
[jvm]
@get:JvmName(name = "url")
actual val url: HttpUrlRepresentation
[nonJvm]
actual val url: HttpUrlRepresentation