A widely discoussed problem on StackOverflow is how one gets the raw string from the respone of a Retrofit 2 request. The Approache with intercepting or using the enqueue() function does not work really well. Once the Reponse is created for the first time the enqueue function will throw an error that it can not get the content since it was already consumed.
So but one now ? Maybe you know that Retrofit is using okhttp3. The cool thing is we can send requests directly with an OkHttpClient instance.
//raw text Request request = call.clone().request(); OkHttpClient client = new OkHttpClient(); okhttp3.Response test = client.newCall(request).execute(); System.out.println(test.body().string());