POST封装
public class MyInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request orinal = chain.request();
FormBody formBody1= (FormBody) orinal.body();
FormBody.Builder builder = new FormBody.Builder();
for(int i=0;i<formBody1.size();i++){
String name = formBody1.name(0);
String value = formBody1.value(0);
builder .add(name, value);
}
builder .add("source", "android");
FormBody build = builder.build();
Request re = orinal.newBuilder().url(orinal.url()).post(build).build();
return chain.proceed(re);
}
}
GET