您的位置:首页 > 其它

拦截器

2017-11-20 20:38 92 查看
拦截器
package com.bwie.wangyetain1509d20171120.OkHttpUtils.okhttp.okhttp;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
* Created by hp on 2017/11/20.
*/
public class MyInterCepter implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
String url = request.url().toString();
String newurl = url + "&source=android";
Request.Builder builder = request.newBuilder();
builder.url(newurl);
Request request1 = builder.build();
Response response = chain.proceed(request1);
return response;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  拦截器