diff --git a/lib/rest/rest.go b/lib/rest/rest.go index dd0b3004d..0796c3e43 100644 --- a/lib/rest/rest.go +++ b/lib/rest/rest.go @@ -16,6 +16,7 @@ import ( "github.com/pkg/errors" "github.com/rclone/rclone/fs" + "github.com/rclone/rclone/lib/readers" ) // Client contains the info to sustain the API @@ -198,7 +199,7 @@ func (api *Client) Call(opts *Opts) (resp *http.Response, err error) { if opts.Parameters != nil && len(opts.Parameters) > 0 { url += "?" + opts.Parameters.Encode() } - body := opts.Body + body := readers.NoCloser(opts.Body) // If length is set and zero then nil out the body to stop use // use of chunked encoding and insert a "Content-Length: 0" // header.