So I send net/http requests and i get res.Body that I have to Close. The problem is that I wrap that reader depending on the encoding:
var reader io.Reader
switch res.Header.Get("Content-Encoding") {
case "br":
reader = brotli.NewReader(res.Body)
default:
reader = res.Body
}```
and then I subsequently return that wrapped reader. The problem is then how do i Close the body after I use it? Since its wrapped I don't have access to the body so I just can't close it.