package com.rc.httpcore.interceptor

import android.util.Log
import com.blankj.utilcode.util.LogUtils
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException

class ResponseInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val response = chain.proceed(chain.request())
        if (!response.isSuccessful || response.body == null) {
            LogUtils.json(response)
            throw IOException("Response failed or body is null")
        }
        return response
    }
}