I wanted to log the data retrieved by OkHttpClient for debugging purposes. After digging for a while, the process seems quite straight-forward now.
First, we create the OkHttpClient:
OkHttpClient client = new OkHttpClient();
client.setFollowRedirects(false);
client.setFollowSslRedirects(false);
Then, we add an interceptor:
client.interceptors().add((chain) -> { /** Interceptor