My Retrofit 2 (2.0.2 currently) client needs to add custom headers to requests. I’m using an Interceptor to add these headers to all requests: Some headers I always want to add, but some headers I only need to add based on requirements of that specific endpoint, for example whether the user needs to be authenticated or not. I’d like to
Tag: retrofit2
Logging with Retrofit 2
I’m trying to get the exact JSON that is being sent in the request. Here is my code: But I only see this in the logs: How am I supposed to do proper logging, given the removal of setLog() and setLogLevel() which we used to use with Retrofit 1? Answer In Retrofit 2 you should use HttpLoggingInterceptor. Add dependency to