I\'m trying to get the exact JSON that is being sent in the request. Here is my code:
OkHttpClient client = new OkHt
First Add dependency to build.gradle:
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
While using Kotlin you can add Logging Interceptor like this :
companion object {
val okHttpClient = OkHttpClient().newBuilder()
.addInterceptor(HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
})
.build()
fun getRetrofitInstance(): Retrofit {
val retrofit = Retrofit.Builder()
.client(okHttpClient)
.baseUrl(ScanNShopConstants.BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build()
return retrofit
}
}