If you use a Log
this way rescuing the body from response :
Log.wtf(TAG,""+response.body().string());
Correctly prints the JSON value. Something in this format:
{"error":true,"message":"Login failed. Incorrect credentials"}
But if I insert the object of response.body().string()
into a JSONObject
like this:
JSONObject jsonObject = new JSONObject(response.body().string());
It gives the following error:
java.io.IOException: Content-Length and stream length disagree
What could be happening?