拦截器

来源:互联网 发布:python取代js 编辑:程序博客网 时间:2024/06/12 22:50
public class LoggingInterceptor implements Interceptor {    @Override    public Response intercept(Chain chain) throws IOException {        Request request = chain.request();        HttpUrl url = request.url().newBuilder()                .addQueryParameter("source","android")                .build();        //添加请求头        Request builder = request.newBuilder()                .url(url)                .build();        return chain.proceed(builder);    }}
原创粉丝点击