fix when if buffer is not aligned

This commit is contained in:
Chris Lu 2018-09-17 00:27:40 -07:00
parent 97575e7185
commit 865a017936

View file

@ -129,11 +129,10 @@ func GetBufferStream(url string, values url.Values, allocatedBytes []byte, eachB
if r.StatusCode != 200 {
return fmt.Errorf("%s: %s", url, r.Status)
}
bufferSize := len(allocatedBytes)
for {
n, err := r.Body.Read(allocatedBytes)
if n == bufferSize {
eachBuffer(allocatedBytes)
if n > 0 {
eachBuffer(allocatedBytes[:n])
}
if err != nil {
if err == io.EOF {