Both Response#returnResponse()
and Response#returnContent()
force the HttpResponse
InputStream
to be read. Since you can't read the InputStream
twice, the library has put flag and a check to assert that the InputStream
hasn't been consumed.
You don't get around this. What you do is get the underlying HttpResponse
object and get both the status code and the body as bytes.
HttpResponse httpResponse = response.returnResponse();
httpResponse.getStatusLine().getStatusCode();
byte[] bytes = EntityUtils.toByteArray(httpResponse.getEntity());