refs class Interceptor
This commit is contained in:
parent
17b6b6d577
commit
0f8c698f8b
|
@ -0,0 +1,25 @@
|
|||
package verdnatura.es.repartoverdnatura.UTILS
|
||||
|
||||
import android.content.Context
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import java.io.IOException
|
||||
|
||||
class SilexInterceptor : Interceptor {
|
||||
private var context: Context
|
||||
|
||||
constructor(context: Context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
|
||||
val request = chain.request()
|
||||
val newRequest = request.newBuilder()
|
||||
.addHeader("Authorization", Utils.getTokenUser(context))
|
||||
.build()
|
||||
return chain.proceed(newRequest)
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue