Update ReadFrom to wrap reader in NopCloser

Wrapping the reader in a NopCloser is necessary to prevent the http library from closing the input reader.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan 2015-05-11 16:39:12 -07:00
parent ecaa643cb2
commit 17cbbf648f

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"time"
@ -33,7 +34,7 @@ func (hlu *httpLayerUpload) handleErrorResponse(resp *http.Response) error {
}
func (hlu *httpLayerUpload) ReadFrom(r io.Reader) (n int64, err error) {
req, err := http.NewRequest("PATCH", hlu.location, r)
req, err := http.NewRequest("PATCH", hlu.location, ioutil.NopCloser(r))
if err != nil {
return 0, err
}