Code Room
Code reviewMediumcr-g505
Subject Timeout handlingLevel Mid–Senior~16 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

Review this Java HTTP client config used for all calls to a slow third-party API.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
OkHttpClient client = new OkHttpClient.Builder()    .connectTimeout(2, TimeUnit.SECONDS)    .build(); String fetch(String url) throws IOException {    try (Response r = client.newCall(new Request.Builder().url(url).build()).execute()) {        return r.body().string();    }}
Run or narrate your approach, then ask the coach.