How can I get what my api url is hitting in retrfit, I want to check what is my request url is generating in kotlin android.
Asked
Active
Viewed 124 times
0
-
1You should use `Interceptors` with a custom `OkHttpClient`. – Darshan Dec 09 '21 at 12:57
-
used already, how to get url formed with request parameters – Nish Lamba Dec 09 '21 at 13:00
-
1The standard OkHttp logging interceptor should log the URL with request parameters to Logcat. – CommonsWare Dec 09 '21 at 13:13
1 Answers
0
In your Retrofit client you should add a specific interceptor to do this.
val loggingInterceptor = HttpLoggingInterceptor().setLevel(Level.BODY)
val retrofitClient = Builder()
.addInterceptor(loggingInterceptor)
.build()
Interceptors have a lot a levels to determine how verbose the logs should be, check Retrofit's documentation for further information

Diego Marcher
- 378
- 3
- 7