How to Get HTTP Status Code using OkHttp without Loading the Entire Response First

29 Views Asked by At

I'm attempting to make a GET request using OkHttp library in my Android App. I need to get the response code only and not the entire response body.

val response response = client.newCall(request).execute();

I know I can use the response.code() method to obtain the status code but the execute method doesn't complete unless the response is fully downloaded. I need to proceed step by step.

0

There are 0 best solutions below