Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 65 for Interceptor (0.2 sec)

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

     *   }
     * ```
     */
    fun interface Interceptor {
      @Throws(IOException::class)
      fun intercept(chain: Chain): Response
    
      companion object {
        /**
         * Constructs an interceptor for a lambda. This compact syntax is most useful for inline
         * interceptors.
         *
         * ```kotlin
         * val interceptor = Interceptor { chain: Interceptor.Chain ->
         *     chain.proceed(chain.request())
         * }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  2. okhttp-logging-interceptor/api/logging-interceptor.api

    public final class okhttp3/logging/HttpLoggingInterceptor : okhttp3/Interceptor {
    	public static final field Companion Lokhttp3/logging/HttpLoggingInterceptor$Companion;
    	public final fun -deprecated_level ()Lokhttp3/logging/HttpLoggingInterceptor$Level;
    	public fun <init> ()V
    	public fun <init> (Lokhttp3/logging/HttpLoggingInterceptor$Logger;)V
    	public synthetic fun <init> (Lokhttp3/logging/HttpLoggingInterceptor$Logger;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 4.5K bytes
    - Viewed (1)
  3. docs/features/interceptors.md

    ![Interceptors Diagram](../assets/images/interceptors@2x.png)
    
    ### Application Interceptors
    
    Interceptors are registered as either _application_ or _network_ interceptors. We'll use the `LoggingInterceptor` defined above to show the difference.
    
    Register an _application_ interceptor by calling `addInterceptor()` on `OkHttpClient.Builder`:
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Feb 06 02:19:09 GMT 2022
    - 8.1K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/InterceptorTest.kt

          assertThat(expected.message).isEqualTo(
            "network interceptor $interceptor must call proceed() exactly once",
          )
        }
      }
    
      @Test
      fun networkInterceptorsCannotChangeServerAddress() {
        server.enqueue(
          MockResponse.Builder()
            .code(500)
            .build(),
        )
        val interceptor =
          Interceptor { chain: Interceptor.Chain ->
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 27.8K bytes
    - Viewed (0)
  5. okhttp-logging-interceptor/README.md

    Logging Interceptor
    ===================
    
    An [OkHttp interceptor][interceptors] which logs HTTP request and response data.
    
    ```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()`.
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Dec 17 15:34:10 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  6. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

     *
     * The format of the logs created by this class should not be considered stable and may
     * change slightly between releases. If you need a stable logging format, use your own interceptor.
     */
    class HttpLoggingInterceptor
      @JvmOverloads
      constructor(
        private val logger: Logger = Logger.DEFAULT,
      ) : Interceptor {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
  7. okhttp/src/main/kotlin/okhttp3/internal/http/RealInterceptorChain.kt

        // Call the next interceptor in the chain.
        val next = copy(index = index + 1, request = request)
        val interceptor = interceptors[index]
    
        @Suppress("USELESS_ELVIS")
        val response =
          interceptor.intercept(next) ?: throw NullPointerException(
            "interceptor $interceptor returned null",
          )
    
        if (exchange != null) {
          check(index + 1 >= interceptors.size || next.calls == 1) {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (0)
  8. okhttp/src/test/java/okhttp3/OkHttpClientTest.kt

      @Test fun clonedInterceptorsListsAreIndependent() {
        val interceptor =
          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)
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 13.2K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/CheckHandshake.java

    import java.util.Collections;
    import java.util.Set;
    import okhttp3.CertificatePinner;
    import okhttp3.Interceptor;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    
    public final class CheckHandshake {
      /** Rejects otherwise-trusted certificates. */
      private static final Interceptor CHECK_HANDSHAKE_INTERCEPTOR = new Interceptor() {
        final Set<String> denylist = Collections.singleton(
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Apr 15 14:55:09 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/RewriteResponseCacheControl.java

    import java.io.IOException;
    import okhttp3.Cache;
    import okhttp3.Interceptor;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    
    public final class RewriteResponseCacheControl {
      /** Dangerous interceptor that rewrites the server's cache-control header. */
      private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = chain -> {
        Response originalResponse = chain.proceed(chain.request());
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 2.6K bytes
    - Viewed (0)
Back to top