mirror of
https://github.com/rclone/rclone.git
synced 2024-11-29 03:45:25 +01:00
rest: add optional GetBody function for HTTP call
This commit is contained in:
parent
82f9554474
commit
4af0c1d902
@ -130,7 +130,8 @@ type Opts struct {
|
|||||||
Path string // relative to RootURL
|
Path string // relative to RootURL
|
||||||
RootURL string // override RootURL passed into SetRoot()
|
RootURL string // override RootURL passed into SetRoot()
|
||||||
Body io.Reader
|
Body io.Reader
|
||||||
NoResponse bool // set to close Body
|
GetBody func() (io.ReadCloser, error) // body builder, needed to enable low-level HTTP/2 retries
|
||||||
|
NoResponse bool // set to close Body
|
||||||
ContentType string
|
ContentType string
|
||||||
ContentLength *int64
|
ContentLength *int64
|
||||||
ContentRange string
|
ContentRange string
|
||||||
@ -239,6 +240,9 @@ func (api *Client) Call(ctx context.Context, opts *Opts) (resp *http.Response, e
|
|||||||
if len(opts.TransferEncoding) != 0 {
|
if len(opts.TransferEncoding) != 0 {
|
||||||
req.TransferEncoding = opts.TransferEncoding
|
req.TransferEncoding = opts.TransferEncoding
|
||||||
}
|
}
|
||||||
|
if opts.GetBody != nil {
|
||||||
|
req.GetBody = opts.GetBody
|
||||||
|
}
|
||||||
if opts.Trailer != nil {
|
if opts.Trailer != nil {
|
||||||
req.Trailer = *opts.Trailer
|
req.Trailer = *opts.Trailer
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user