Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for CacheResponse (0.07 sec)

  1. okhttp/src/commonJvmAndroid/kotlin/okhttp3/Response.kt

            checkSupportResponse("networkResponse", networkResponse)
            this.networkResponse = networkResponse
          }
    
        open fun cacheResponse(cacheResponse: Response?) =
          apply {
            checkSupportResponse("cacheResponse", cacheResponse)
            this.cacheResponse = cacheResponse
          }
    
        private fun checkSupportResponse(
          name: String,
          response: Response?,
        ) {
          response?.apply {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 28 14:39:28 UTC 2025
    - 18.1K bytes
    - Viewed (0)
  2. docs/recipes.md

     [CacheResponseJava]: https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/CacheResponse.java
     [CacheResponseKotlin]: https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/kt/CacheResponse.kt
     [CancelCallJava]: https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/CancelCall.java
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 17:01:12 UTC 2025
    - 47.8K bytes
    - Viewed (0)
  3. android-test/src/test/kotlin/okhttp/android/test/BaseOkHttpClientUnitTest.kt

        call.execute().use { response ->
          assertThat(response.code).isEqualTo(200)
          assertThat(response.cacheResponse).isNull()
        }
    
        val cachedCall = client.newCall(request)
    
        cachedCall.execute().use { response ->
          assertThat(response.code).isEqualTo(200)
          assertThat(response.cacheResponse).isNotNull()
        }
      }
    
      @Test
      open fun testPublicSuffixDb() {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Tue Jul 22 20:03:31 UTC 2025
    - 2.3K bytes
    - Viewed (0)
  4. okhttp/src/jvmTest/kotlin/okhttp3/KotlinSourceModernTest.kt

        val builder: Response.Builder = response.newBuilder()
        val redirect: Boolean = response.isRedirect
        val networkResponse: Response? = response.networkResponse
        val cacheResponse: Response? = response.cacheResponse
        val priorResponse: Response? = response.priorResponse
        val challenges: List<Challenge> = response.challenges()
        val cacheControl: CacheControl = response.cacheControl
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Jun 21 20:36:35 UTC 2025
    - 46.5K bytes
    - Viewed (0)
  5. android-test/src/androidTest/java/okhttp/android/test/OkHttpTest.kt

              assertNull(it.cacheResponse)
              assertNotNull(it.networkResponse)
    
              assertEquals(3, it.cacheControl.maxAgeSeconds)
              assertTrue(it.cacheControl.isPublic)
            }
    
          client
            .newCall(request)
            .execute()
            .use {
              assertEquals(200, it.code)
              assertNotNull(it.cacheResponse)
              assertNull(it.networkResponse)
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 02 14:12:28 UTC 2025
    - 29K bytes
    - Viewed (0)
  6. okhttp/src/commonJvmAndroid/kotlin/okhttp3/Cache.kt

        requestCount++
    
        if (cacheStrategy.networkRequest != null) {
          // If this is a conditional request, we'll increment hitCount if/when it hits.
          networkCount++
        } else if (cacheStrategy.cacheResponse != null) {
          // This response uses the cache and not the network. That's a cache hit.
          hitCount++
        }
      }
    
      @Synchronized internal fun trackConditionalCacheHit() {
        hitCount++
      }
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 16 09:39:51 UTC 2025
    - 26.9K bytes
    - Viewed (0)
  7. okhttp/api/jvm/okhttp.api

    	public final fun -deprecated_sentRequestAtMillis ()J
    	public final fun body ()Lokhttp3/ResponseBody;
    	public final fun cacheControl ()Lokhttp3/CacheControl;
    	public final fun cacheResponse ()Lokhttp3/Response;
    	public final fun challenges ()Ljava/util/List;
    	public fun close ()V
    	public final fun code ()I
    	public final fun handshake ()Lokhttp3/Handshake;
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 16 09:39:51 UTC 2025
    - 69.4K bytes
    - Viewed (0)
  8. CHANGELOG.md

        )
        ```
    
     *  New: `Response.body` is now non-null. This was generally the case in OkHttp 4.x, but the Kotlin
        type declaration was nullable to support rare cases like the body on `Response.cacheResponse`,
        `Response.networkResponse`, and `Response.priorResponse`. In such cases the body is now
        non-null, but attempts to read its content will fail.
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 19:32:33 UTC 2025
    - 31.6K bytes
    - Viewed (1)
  9. okhttp/src/jvmTest/kotlin/okhttp3/CallTest.kt

          .assertReceivedResponseAtMillis(request1SentAt, request1ReceivedAt)
    
        // Check the cached response. Its request contains only the saved Vary headers.
        cacheHit
          .cacheResponse()
          .assertCode(200)
          .assertHeaders(
            Headers
              .Builder()
              .add("ETag", "v1")
              .add("Cache-Control", "max-age=60")
              .add("Vary", "Accept-Charset")
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Jul 31 04:18:40 UTC 2025
    - 146.6K bytes
    - Viewed (0)
  10. okhttp/api/android/okhttp.api

    	public final fun -deprecated_sentRequestAtMillis ()J
    	public final fun body ()Lokhttp3/ResponseBody;
    	public final fun cacheControl ()Lokhttp3/CacheControl;
    	public final fun cacheResponse ()Lokhttp3/Response;
    	public final fun challenges ()Ljava/util/List;
    	public fun close ()V
    	public final fun code ()I
    	public final fun handshake ()Lokhttp3/Handshake;
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 16 09:39:51 UTC 2025
    - 69.4K bytes
    - Viewed (0)
Back to top