mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
Add context to all http.NewRequest #3257
When we drop support for go1.12 we can use http.NewRequestWithContext
This commit is contained in:
@@ -212,10 +212,11 @@ func (api *Client) Call(ctx context.Context, opts *Opts) (resp *http.Response, e
|
||||
if opts.ContentLength != nil && *opts.ContentLength == 0 {
|
||||
body = nil
|
||||
}
|
||||
req, err := http.NewRequestWithContext(ctx, opts.Method, url, body)
|
||||
req, err := http.NewRequest(opts.Method, url, body)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
req = req.WithContext(ctx) // go1.13 can use NewRequestWithContext
|
||||
headers := make(map[string]string)
|
||||
// Set default headers
|
||||
for k, v := range api.headers {
|
||||
|
||||
Reference in New Issue
Block a user