delete body copy

This commit is contained in:
eson 2018-12-18 00:57:31 +08:00
parent 2e315b1b52
commit 1f673f991f

View File

@ -4,7 +4,6 @@ import (
"bytes"
"compress/gzip"
"compress/zlib"
"io"
"io/ioutil"
"net/http"
)
@ -25,14 +24,14 @@ func FromHTTPResponse(resp *http.Response) (*Response, error) {
}
resp.Body.Close()
cbuf := bytes.NewBuffer([]byte{})
_, err = io.Copy(cbuf, bytes.NewReader(srcbuf))
// cbuf := bytes.NewBuffer([]byte{})
// _, err = io.Copy(cbuf, bytes.NewReader(srcbuf))
if err != nil {
panic(err)
}
// if err != nil {
// panic(err)
// }
resp.Body = ioutil.NopCloser(cbuf)
// resp.Body = ioutil.NopCloser(cbuf)
content := string(srcbuf)
srcReader := bytes.NewReader(srcbuf)