美文网首页
Android OkLogInterceptor

Android OkLogInterceptor

作者: 人心所向便是阳光 | 来源:发表于2018-12-10 07:51 被阅读0次
    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);
    }
    

    }

    相关文章

      网友评论

          本文标题:Android OkLogInterceptor

          本文链接:https://www.haomeiwen.com/subject/wnwlhqtx.html