diff --git a/lib/rest/rest.go b/lib/rest/rest.go index 1a746f090..0cdccf028 100644 --- a/lib/rest/rest.go +++ b/lib/rest/rest.go @@ -444,6 +444,9 @@ func (api *Client) callCodec(ctx context.Context, opts *Opts, request interface{ var overhead int64 opts.Body, opts.ContentType, overhead, err = MultipartUpload(opts.Body, params, opts.MultipartContentName, opts.MultipartFileName) + if err != nil { + return nil, err + } if opts.ContentLength != nil { *opts.ContentLength += overhead }