I am using Retrofit 2 and Okhttp for my Android project. I want to add some headers to the api request.
This is my interceptor code:
public class NetworkInterceptors implements Interceptor { @Override public Response intercept(Interceptor.Chain chain) throws IOException { Request request = chain.request().newBuilder() .addHeader("Userid", "10034") .addHeader("Securitykey", "Fb47Gi") .build(); return chain.proceed(request); } }
This does not work properly. On the server side, I get only the last header added (in the above example, I only get the Securitykey missing "Userid")
Please, help.
source share