Home > database >  Fetching the response with peekBody() somehow blocks any following code
Fetching the response with peekBody() somehow blocks any following code

Time:10-07

Somewhere in my code I consume the response of a http call:

@Override
                public void onResponse(Call call, final okhttp3.Response response) throws IOException {
                    String res = response.peekBody(99999L).string();
                    //String res = response.body().string();
                    Log.d("shalocmo", "okhttp3:"   res);
                    Log.d("shalocmo", "okhttp3: here");

First debug line with return string returns perfectly. Second debug line never appears... According to docs and common sense (I don't do anything in between both lines), I don't understand why it would never appear. I don't get any exceptions, or Error messages except the "E/memtrack: Couldn't load memtrack module" message I get all over the place. Can anybody help me out here ?

CodePudding user response:

Try changing your peekBody() size down to something small, like 99L, and see what happens. There's a good chance that you're trying to peek too much data

  • Related