You are reading a single comment by @Velocio and its replies. Click here to read the full conversation.
  • Also... TIL...

    resp, err := http.Get(...)
    if err != nil { return err }
    defer resp.body.Close()
    json.NewDecoder(resp.Body).Decode(&foo)
    

    This leaves the HTTP connection open a fraction longer than desired, because it may not have consumed the input up to the EOF.

    Need to add this after it:

    io.Copy(ioutil.Discard, resp.Body)
    
About

Avatar for Velocio @Velocio started