Skip to content

//okhttp/okhttp3/Response/request

request

[common, nonJvm]\ [common]\ expect val request: Request

[nonJvm]\ actual val request: Request

The request that initiated this HTTP response. This is not necessarily the same request issued by the application:

  • It may be transformed by the user’s interceptors. For example, an application interceptor may add headers like User-Agent.
  • It may be the request generated in response to an HTTP redirect or authentication challenge. In this case the request URL may be different than the initial request URL.

Use the request of the networkResponse field to get the wire-level request that was transmitted. In the case of follow-ups and redirects, also look at the request of the priorResponse objects, which have its own priorResponse.

[jvm]\

@get:JvmName(name = "request")

actual val request: Request