I am using retrofit 2.x and i want to log the header and body of request and response .
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
Instead of using addInterceptor to add the logging interceptor, use addNetworkInterceptor, to include headers added by OkHttp.
addInterceptor
addNetworkInterceptor
Network interceptors are able to:
Observe the data just as it will be transmitted over the network.