at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.onFailure(DefaultCallAdapterFactory.java:96)
class RetrofitService {
private val BASE_URL = "https://jsonplaceholder.typicode.com/"
private val loggingInterceptor = HttpLoggingInterceptor()
private val httpClient = OkHttpClient.Builder().addInterceptor(loggingInterceptor).build()
private val builder = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(httpClient)
private val retrofit = builder.build()
init {
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
}
fun <S> createService(
serviceClass: Class<S>
): S {
return retrofit.create(serviceClass)
}
}