Code RoomResponse body not read
MediumPrep Room Coding #2216

Response body not read

Code reviewNetworking & APIsMid–Senior~18 min

Review this Go HTTP client helper.

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.

0:00 of about 18 min
Mark a line and say what kind of problem it is.0 findings
1func fetchStatus(url string) (int, error) {
2 resp, err := http.Get(url)
3 if err != nil {
4 return 0, err
5 }
6 if resp.StatusCode != 200 {
7 return resp.StatusCode, fmt.Errorf("bad status")
8 }
9 body, _ := io.ReadAll(resp.Body)
10 resp.Body.Close()
11 return len(body), nil
12}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.