"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
rest: Add RemoveHeader and SetCookie method
hensurba7ae2ee8ccf
diff --git a/lib/rest/rest.go b/lib/rest/rest.goindex 3403e4155..847b69310 100644--- a/lib/rest/rest.go+++ b/lib/rest/rest.go@@ -80,6 +80,14 @@ func (api *Client) SetHeader(key, value string) *Client {return api}+// RemoveHeader unsets a header for all requests+func (api *Client) RemoveHeader(key string) *Client {+ api.mu.Lock()+ defer api.mu.Unlock()+ delete(api.headers, key)+ return api+}+// SignerFn is used to sign an outgoing requesttype SignerFn func(*http.Request) error@@ -100,6 +108,19 @@ func (api *Client) SetUserPass(UserName, Password string) *Client {return api}+// SetCookie creates an Cookies Header for all requests with the supplied+// cookies passed in.+// All cookies have to be supplied at once, all cookies will be overwritten+// on a new call to the method+func (api *Client) SetCookie(cks ...*http.Cookie) *Client {+ req, _ := http.NewRequest("GET", "http://example.com", nil)+ for _, ck := range cks {+ req.AddCookie(ck)+ }+ api.SetHeader("Cookie", req.Header.Get("Cookie"))+ return api+}+// Opts contains parameters for Call, CallJSON etctype Opts struct {Method string // GET, POST etc