拦截器的请求头


/**
 * 添加请求头
 */
public class UserAgentIntercepter implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {

        Request request =  chain.request().newBuilder()
                .addHeader("key1","value")
                .build();

        return chain.proceed(request);
    }


http://120.27.23.105/product/searchProducts?keywords=%E6%89%8B%E6%9C%BA&page=1

你可能感兴趣的:(移动开发)