统一请求头

 public static void MyHeader(){
        OkHttpClient.Builder builder1 = new OkHttpClient().newBuilder();
        builder1.addInterceptor(new Interceptor() {
            @Override
            public Response intercept(Chain chain) throws IOException {
                Request builder = chain.request().newBuilder()
                        .addHeader("userId",MainActivity.userId)
                        .addHeader("sessionId",MainActivity.sessionId)
                        .build();
                return chain.proceed(builder);
            }
        });
        build = builder1.build();
    }

 

你可能感兴趣的:(电商类)