Skip to content

//okhttp/okhttp3/Request/Builder/tag

tag

[jvm]\ open fun tag(tag: Any?): Request.Builder

Attaches tag to the request using Object.class as a key.

[jvm, common]\ [jvm]\ open fun <T> tag(type: Class<in T>, tag: T?): Request.Builder

[common]\ expect fun <T : Any> tag(type: KClass<T>, tag: T?): Request.Builder

Attaches tag to the request using type as a key. Tags can be read from a request using Request.tag. Use null to remove any existing tag assigned for type.

Use this API to attach timing, debugging, or other application data to a request so that you may read it in interceptors, event listeners, or callbacks.

[common]\ expect inline fun <T : Any> tag(tag: T?): Request.Builder

Attaches tag to the request using T as a key. Tags can be read from a request using Request.tag. Use null to remove any existing tag assigned for T.

Use this API to attach timing, debugging, or other application data to a request so that you may read it in interceptors, event listeners, or callbacks.

[jvm, nonJvm]\ [jvm]\

@JvmName(name = "reifiedTag")

actual inline fun <T : Any> tag(tag: T?): Request.Builder

[nonJvm]\ actual inline fun <T : Any> tag(tag: T?): Request.Builder

[jvm, nonJvm]\ actual fun <T : Any> tag(type: KClass<T>, tag: T?): Request.Builder