Retrofit으로 작업시 통신관련 디버깅을 하려면 ttpLoggingInterceptor가 필요하다 사용방법은 다음과 같다
val interceptor = HttpLoggingInterceptor()
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY)
val client = OkHttpClient.Builder()
.addInterceptor(interceptor)
.connectTimeout(2000L,TimeUnit.SECONDS)
.build()
val retrofit = Retrofit.Builder()
.baseUrl("http://apis.data.go.kr")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build()
이와같이 client형태로 추가해 주면 디버깅http디버깅을 해줄수 있다.