2
我有一个场景,我添加一个拦截器,其中包含一个Authorization
String
在标题中从API获取token
。当我取回一个令牌时,我希望添加一个新的拦截器,它将接收到的令牌添加到所有后续请求的头部。添加和删除拦截器
如何删除之前包含Authorization
令牌的拦截器,因为它不再需要?
private void removeAuthorizationInterceptor()
{
for (Interceptor interceptor : App.getOkHttpClient().newBuilder().networkInterceptors())
{
// Find the interceptor which has the Authorization token and remove it
}
}