SimpleInterceptor

SimpleInterceptor is the Android OkHttp client’s interceptor interface tool for easy testing and development.

Environmental requirements

  1. The Android 4.1 +
  2. OkHttp 3.x or 4.x
  3. androidx

Git address

Github address: github.com/smartbackme… Domestic address: gitee.com/dileber/Sim… Github will give you a star warning if you feel good:

The data generated and stored when using this interceptor may contain sensitive information, such as authorization or Cookie headers, as well as the contents of request and response bodies.

As such, it can only be used during debugging and cannot be published online

Configure project: build.gradle

buildscript {
    repositories {
        maven { url 'https://www.jitpack.io' }
    }
Copy the code

Version association with OKHTTP: if the app integrates okHttp3 3.+ then use version 3.0 code. If the app integrates okHttp3 4.+ then use version 4.0 code

Dependencies okhttp3 3. + {debugImplementation 'com. Making. Smartbackme. SimpleInterceptor: SimpleInterceptor - debug: 3.0' ReleaseImplementation 'com. Making. Smartbackme. SimpleInterceptor: SimpleInterceptor - release: 3.0'} or okhttp3 4 + Dependencies {debugImplementation 'com. Making. Smartbackme. SimpleInterceptor: SimpleInterceptor - debug: 4.0' ReleaseImplementation 'com. Making. Smartbackme. SimpleInterceptor: SimpleInterceptor - release: 4.0'}Copy the code

Use:


OkHttpClient.Builder()
            .addInterceptor(SimpleInterceptor(context))
            .build()
Copy the code