You may find the following articles on http.Client useful. https://medium.com/hackernoon/avoiding-memory-leak-in-golang-api-1843ef45fca8 http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/index.html#close_http_resp_body https://tleyden.github.io/blog/2016/11/21/tuning-the-go-http-client-library-for-load-testing/
-- Kevin Powick On Monday, 25 November 2019 12:54:04 UTC-5, Liam wrote: > > Scenario: > Sending a client request and only reading the whole Response.Body for > certain .StatusCode values, and/or reading only the first N bytes. > > Docs for Client.Do() > "If the Body is not both read to EOF and closed, the Client's underlying > RoundTripper (typically Transport) may not be able to re-use a persistent > TCP connection..." > > Docs for Client.Get/Post() > "Caller should close resp.Body when done reading from it." > > Questions: > - does the read-to-EOF stipulation also apply to Client.Get/Post() ? > - why does Response.Body.Close() before io.EOF not release unread buffers > or otherwise prepare it for persistence? > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f11ee813-7d1d-436f-acbb-a2beb82fc384%40googlegroups.com.