public class OkLogInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request=chain.request();
String method = request.method();
HttpUrl url = request.url();
LogUtil.d("本次请求","url:"+url.toString()+"method:"+method);
Headers headers=request.headers();
Set<String> names = headers.names();
Iterator<String> iterator = names.iterator();
while (iterator.hasNext()) {
String next = iterator.next();
String value = headers.get(next);
LogUtil.d(next+":"+value);
}
return chain.proceed(request);
}
}
网友评论