Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 21 for addNetworkInterceptor (0.34 sec)

  1. okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt

        fun addNetworkInterceptor(interceptor: Interceptor) =
          apply {
            networkInterceptors += interceptor
          }
    
        @JvmName("-addNetworkInterceptor") // Prefix with '-' to prevent ambiguous overloads from Java.
        inline fun addNetworkInterceptor(crossinline block: (chain: Interceptor.Chain) -> Response) =
          addNetworkInterceptor(Interceptor { chain -> block(chain) })
    
        /**
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Apr 06 04:21:33 UTC 2024
    - 52K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/OkHttpClientTest.kt

          Interceptor { chain: Interceptor.Chain ->
            chain.proceed(chain.request())
          }
        val original = clientTestRule.newClient()
        original.newBuilder()
          .addInterceptor(interceptor)
          .addNetworkInterceptor(interceptor)
          .build()
        assertThat(original.interceptors.size).isEqualTo(0)
        assertThat(original.networkInterceptors.size).isEqualTo(0)
      }
    
      /**
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Mar 31 17:16:15 UTC 2024
    - 13.2K bytes
    - Viewed (0)
  3. okhttp/src/test/java/okhttp3/ConnectionReuseTest.kt

            // Since this test knowingly leaks a connection, avoid using the default shared connection
            // pool, which should remain clean for subsequent tests.
            .connectionPool(ConnectionPool())
            .addNetworkInterceptor(
              Interceptor { chain: Interceptor.Chain? ->
                val response =
                  chain!!.proceed(
                    chain.request(),
                  )
                responsesNotClosed.add(response)
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.kt

        closeWebSockets(webSocket, serverListener.assertOpen())
      }
    
      @Test
      fun webSocketAndNetworkInterceptors() {
        client =
          client.newBuilder()
            .addNetworkInterceptor(
              Interceptor { chain: Interceptor.Chain? ->
                throw AssertionError() // Network interceptors don't execute.
              },
            )
            .build()
        webServer.enqueue(
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun Mar 31 17:16:15 UTC 2024
    - 35.2K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/CacheTest.kt

        val url = server.url("/")
        assertThat(get(url).body.string()).isEqualTo("A")
        val ifNoneMatch = AtomicReference<String?>()
        client =
          client.newBuilder()
            .addNetworkInterceptor(
              Interceptor { chain: Interceptor.Chain ->
                ifNoneMatch.compareAndSet(null, chain.request().header("If-None-Match"))
                chain.proceed(chain.request())
              },
            )
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Wed Apr 10 19:46:48 UTC 2024
    - 108.6K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

        builder = builder.addInterceptor { it: Interceptor.Chain -> TODO() }
        val networkInterceptors: List<Interceptor> = builder.networkInterceptors()
        builder = builder.addNetworkInterceptor(Interceptor { TODO() })
        builder = builder.addNetworkInterceptor { it: Interceptor.Chain -> TODO() }
        builder = builder.eventListener(EventListener.NONE)
        builder = builder.eventListenerFactory { TODO() }
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Apr 01 14:21:25 UTC 2024
    - 46.5K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/EventListenerTest.kt

        server.enqueue(
          MockResponse.Builder()
            .body("abc")
            .build(),
        )
        client =
          client.newBuilder()
            .addNetworkInterceptor(
              HttpLoggingInterceptor()
                .setLevel(HttpLoggingInterceptor.Level.BODY),
            )
            .build()
        val call =
          client.newCall(
            Request.Builder()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 56.9K bytes
    - Viewed (2)
  8. okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.kt

            body = "ABC",
            socketPolicy = DisconnectAtEnd,
          ),
        )
        server.enqueue(MockResponse(body = "DEF"))
        val client2 =
          client.newBuilder()
            .addNetworkInterceptor(
              object : Interceptor {
                var executedCall = false
    
                override fun intercept(chain: Interceptor.Chain): Response {
                  if (!executedCall) {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Thu Apr 11 22:09:35 UTC 2024
    - 75.3K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/URLConnectionTest.kt

       * as a **network interceptor**. It will strip the `Location` header of impacted responses to
       * prevent the redirect.
       *
       * ```
       * OkHttpClient client = client.newBuilder()
       *   .addNetworkInterceptor(new LegacyRedirectInterceptor())
       *   .build();
       * ```
       */
      internal class LegacyRedirectInterceptor : Interceptor {
        override fun intercept(chain: Interceptor.Chain): Response {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Jan 20 10:30:28 UTC 2024
    - 131.7K bytes
    - Viewed (0)
  10. okhttp/api/okhttp.api

    	public final fun -addInterceptor (Lkotlin/jvm/functions/Function1;)Lokhttp3/OkHttpClient$Builder;
    	public final fun -addNetworkInterceptor (Lkotlin/jvm/functions/Function1;)Lokhttp3/OkHttpClient$Builder;
    	public fun <init> ()V
    	public final fun addInterceptor (Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient$Builder;
    	public final fun addNetworkInterceptor (Lokhttp3/Interceptor;)Lokhttp3/OkHttpClient$Builder;
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Apr 15 13:41:01 UTC 2024
    - 70.2K bytes
    - Viewed (0)
Back to top