just a bit safer

This commit is contained in:
chrislu 2022-08-31 00:10:17 -07:00
parent 9c944377dc
commit ef78631a7c

View file

@ -408,6 +408,9 @@ func ReadUrlAsReaderCloser(fileUrl string, jwt string, rangeHeader string) (*htt
} }
func CloseResponse(resp *http.Response) { func CloseResponse(resp *http.Response) {
if resp == nil || resp.Body == nil {
return
}
reader := &CountingReader{reader: resp.Body} reader := &CountingReader{reader: resp.Body}
io.Copy(io.Discard, reader) io.Copy(io.Discard, reader)
resp.Body.Close() resp.Body.Close()