Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for addInterceptor (0.33 sec)

  1. okhttp/src/test/java/okhttp3/InterceptorTest.kt

            chain.proceed(chain.request())
          }
        client =
          client.newBuilder()
            .connectTimeout(Duration.ofSeconds(5))
            .addInterceptor(interceptor1)
            .addInterceptor(interceptor2)
            .build()
        val request1 =
          Request.Builder()
            .url("http://" + TestUtil.UNREACHABLE_ADDRESS_IPV4)
            .build()
        val call = client.newCall(request1)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 27.8K bytes
    - Viewed (0)
  2. okhttp-brotli/README.md

    provided Accept-Encoding is not set previously.  Modern web servers
    must choose to return Brotli responses.  n.b. It is not used for
    sending requests.
    
    ```java
    OkHttpClient client = new OkHttpClient.Builder()
      .addInterceptor(BrotliInterceptor.INSTANCE)
      .build();
    ```
    
    ```kotlin
    implementation("com.squareup.okhttp3:okhttp-brotli:4.12.0")
    ```
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 572 bytes
    - Viewed (0)
  3. docs/features/interceptors.md

    Register an _application_ interceptor by calling `addInterceptor()` on `OkHttpClient.Builder`:
    
    ```java
    OkHttpClient client = new OkHttpClient.Builder()
        .addInterceptor(new LoggingInterceptor())
        .build();
    
    Request request = new Request.Builder()
        .url("http://www.publicobject.com/helloworld.txt")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 06 02:19:09 GMT 2022
    - 8.1K bytes
    - Viewed (0)
  4. okhttp-brotli/src/test/java/okhttp3/brotli/BrotliTestMain.kt

     * limitations under the License.
     */
    package okhttp3.brotli
    
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    fun main() {
      val client =
        OkHttpClient.Builder()
          .addInterceptor(BrotliInterceptor)
          .build()
    
      sendRequest("https://httpbin.org/brotli", client)
      sendRequest("https://httpbin.org/gzip", client)
    }
    
    private fun sendRequest(
      url: String,
      client: OkHttpClient,
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.1K bytes
    - Viewed (3)
  5. okhttp-logging-interceptor/README.md

    ```java
    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(Level.BASIC);
    OkHttpClient client = new OkHttpClient.Builder()
      .addInterceptor(logging)
      .build();
    ```
    
    You can change the log level at any time by calling `setLevel()`.
    
    To log to a custom location, pass a `Logger` instance to the constructor.
    ```java
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  6. okhttp-logging-interceptor/src/test/java/okhttp3/logging/HttpLoggingInterceptorTest.kt

                  else -> chain.proceed(chain.request())
                }
              },
            )
            .addNetworkInterceptor(networkInterceptor)
            .addInterceptor(applicationInterceptor)
            .sslSocketFactory(
              handshakeCertificates.sslSocketFactory(),
              handshakeCertificates.trustManager,
            )
            .hostnameVerifier(hostnameVerifier)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 37.6K bytes
    - Viewed (0)
  7. okhttp-android/src/test/kotlin/okhttp3/android/AndroidLoggingTest.kt

        val interceptor =
          HttpLoggingInterceptor.androidLogging(tag = "testHttpLoggingInterceptor").apply {
            level = HttpLoggingInterceptor.Level.BASIC
          }
    
        val client = clientBuilder.addInterceptor(interceptor).build()
    
        try {
          client.newCall(request).execute()
        } catch (uhe: UnknownHostException) {
          // expected
        }
    
        val logs = ShadowLog.getLogsForTag("testHttpLoggingInterceptor")
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 01 11:07:32 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/DispatcherTest.kt

      }
    
      @Test
      fun synchronousCallAccessors() {
        val ready = CountDownLatch(2)
        val waiting = CountDownLatch(1)
        client =
          client.newBuilder()
            .addInterceptor(
              Interceptor { chain: Interceptor.Chain? ->
                try {
                  ready.countDown()
                  waiting.await()
                } catch (e: InterruptedException) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 12.7K bytes
    - Viewed (0)
  9. okhttp/src/test/java/okhttp3/DuplexTest.kt

          MockResponse.Builder()
            .clearHeaders()
            .streamHandler(body)
            .build(),
        )
        client =
          client.newBuilder()
            .addInterceptor(UppercaseRequestInterceptor())
            .addInterceptor(UppercaseResponseInterceptor())
            .build()
        val call =
          client.newCall(
            Request.Builder()
              .url(server.url("/"))
              .post(AsyncRequestBody())
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 20 10:30:28 GMT 2024
    - 23.9K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt

        fun addInterceptor(interceptor: Interceptor) =
          apply {
            interceptors += interceptor
          }
    
        @JvmName("-addInterceptor") // Prefix with '-' to prevent ambiguous overloads from Java.
        inline fun addInterceptor(crossinline block: (chain: Interceptor.Chain) -> Response) =
          addInterceptor(Interceptor { chain -> block(chain) })
    
        /**
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:21:33 GMT 2024
    - 52K bytes
    - Viewed (0)
Back to top