Error: Content-Length and stream length disagree

1

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?

    
asked by anonymous 20.04.2017 / 23:48

0 answers