Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

rest: Add TransferEncoding and Close parameters

Nick Craig-Wood8f2f48062891
diff --git a/rest/rest.go b/rest/rest.go
index a7a248ae5..c443d2269 100644
--- a/rest/rest.go
+++ b/rest/rest.go
@@ -97,6 +97,8 @@ type Opts struct {
MultipartContentName string // and Body and pass in request
MultipartFileName string // for multipart upload
Parameters url.Values // any parameters for the final URL
+ TransferEncoding []string // transfer encoding, set to "identity" to disable chunked encoding
+ Close bool // set to close the connection after this transaction
}
// Copy creates a copy of the options
@@ -176,6 +178,12 @@ func (api *Client) Call(opts *Opts) (resp *http.Response, err error) {
if opts.ContentRange != "" {
headers["Content-Range"] = opts.ContentRange
}
+ if len(opts.TransferEncoding) != 0 {
+ req.TransferEncoding = opts.TransferEncoding
+ }
+ if opts.Close {
+ req.Close = true
+ }
// Set any extra headers
if opts.ExtraHeaders != nil {
for k, v := range opts.ExtraHeaders {