How reading the response body can safe from memory leak

I have read an article https://hackernoon.com/avoiding-memory-leak-in-golang-api-1843ef45fca8, and the author says that we should read the response body even if we do not need it? Why? Why should I read it rather than just closing the body? How it can save from memory leak?

If the body has been read in full, another request can reuse the same TCP connection. This is generally good, but doesn’t result in a memory leak if you don’t do it.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.