I'm getting this error:
Expected BEGIN_OBJECT but was STRING at line 1 column 1 path
In another stackoverflow question, they say I am receiving an array when it should be an object. But my intuition is that I am receiving nothing, but I'm not able to see my json to debug.
I'm trying to log my received json to see what's happening, because I don't see the error in my code.
I coded is mentioned here:
OkHttpClient client = new OkHttpClient();
client.interceptors().add(new Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Buffer buffer = new Buffer();
request.body().writeTo(buffer);
String body = buffer.readUtf8();
Request.Builder builder = chain.request().newBuilder();
String credential = Credentials.basic(user, pass);
builder.addHeader("Authorization", credential).build();
Response response = chain.proceed(builder.build());
return response;
}
});
return client;
But I get a NullPointerException in request.body()
...
What's my next step for debugging???