Update github.com/xenolf/lego to 0.4.1
This commit is contained in:
parent
5042c5bf40
commit
e8d63b2a3b
105 changed files with 4299 additions and 2075 deletions
18
vendor/github.com/JamesClonk/vultr/lib/client.go
generated
vendored
18
vendor/github.com/JamesClonk/vultr/lib/client.go
generated
vendored
|
@ -1,6 +1,7 @@
|
|||
package lib
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
@ -168,8 +169,25 @@ func (c *Client) do(req *http.Request, data interface{}) error {
|
|||
// Throttle http requests to avoid hitting Vultr's API rate-limit
|
||||
c.bucket.Wait(1)
|
||||
|
||||
// Request body gets drained on each read so we
|
||||
// need to save it's content for retrying requests
|
||||
var err error
|
||||
var requestBody []byte
|
||||
if req.Body != nil {
|
||||
requestBody, err = ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error reading request body: %v", err)
|
||||
}
|
||||
req.Body.Close()
|
||||
}
|
||||
|
||||
var apiError error
|
||||
for tryCount := 1; tryCount <= c.MaxAttempts; tryCount++ {
|
||||
// Restore request body to the original state
|
||||
if requestBody != nil {
|
||||
req.Body = ioutil.NopCloser(bytes.NewBuffer(requestBody))
|
||||
}
|
||||
|
||||
resp, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue