package com.isidroid.c23.data.source.network

import okhttp3.CacheControl
import okhttp3.Interceptor
import okhttp3.Response
import timber.log.Timber

class CacheControlInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()
        val urlBuilder = request.url.newBuilder()
//                .addQueryParameter("request_id", UUID.randomUUID().toString())

        val cacheControl = CacheControl.Builder()
            .noCache()
            .build()

        val requestBuilder = request.newBuilder()
            .url(urlBuilder.build())
            .cacheControl(cacheControl)


        val newRequest = requestBuilder.build()

        return chain.proceed(newRequest)
    }
}