package com.isidroid.session.data.source.network

import android.content.Context
import com.isidroid.network.QUERY_MOCK_CODE
import com.isidroid.network.QUERY_MOCK_PARAM
import com.isidroid.network.ext.createMockResponse
import com.isidroid.utils.assetsFileContent
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.Protocol
import okhttp3.Request
import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody

class MockInterceptor(private val context: Context, private val isMock: Boolean) : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        if (!isMock)
            return chain.proceed(chain.request())

       return createMockResponse(context, chain.request())
    }
}