public class Logger implements Interceptor{
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
HttpUrl url=original.url().newBuilder()
//需要添加的公共参数,以键值对形式添加
.addQueryParameter("source","android")
.build();
//添加请求头
Request request = original.newBuilder()
.url(url)
.build();
return chain.proceed(request);
}
}
简单的拦截器请求头
最新推荐文章于 2023-11-09 17:24:23 发布