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)
pull/387/head
Derek McGowan 2015-05-11 16:39:12 -07:00
parent 49f7f54d07
commit 68d5ecf6bf
1 changed files with 2 additions and 1 deletions

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
}