While debugging my HttpResponse object in my Android application I kept coming across an the error while attempting
to get my response content via response.getEntity().getContent()
:
IllegalStateException: Content has been consumed
I puzzled and puzzled until my puzzler was sore, and then I realized that I had put result.response.getEntity().getContent()
in my watch window in an effort to debug the result.
Turns out this is a bad idea!
Calling .getContent()
in the watch window causes the content to be consumed in the watch window, thus causing the above exception to be thrown when the application attempts to retrieve it.
by Shayla Sawchenko