remove unnecessary buffer while discarding stream (#7214)

This commit is contained in:
Sidhartha Mani 2019-02-08 19:29:51 -08:00 committed by Harshavardhana
parent 18c4ecbbef
commit c1b3f1994b

View File

@ -44,9 +44,7 @@ func DrainBody(respBody io.ReadCloser) {
// Without this closing connection would disallow re-using
// the same connection for future uses.
// - http://stackoverflow.com/a/17961593/4465767
bufp := b512pool.Get().(*[]byte)
defer b512pool.Put(bufp)
io.CopyBuffer(ioutil.Discard, respBody, *bufp)
respBody.Close()
defer respBody.Close()
io.Copy(ioutil.Discard, respBody)
}
}