8128: Add arvados.v1.api_client_authorizations.current
[arvados.git] / sdk / go / arvadosclient / arvadosclient.go
index 2b6a36abec5edca9aae9f71f11860e50e0856753..8cdfa484bd96df3f479c7a40c8bb6692eddc1da5 100644 (file)
@@ -165,13 +165,13 @@ func (c ArvadosClient) CallRaw(method string, resourceType string, uuid string,
 
        retryable := false
        switch method {
-       case "GET", "HEAD", "PUT", "OPTIONS", "POST", "DELETE":
+       case "GET", "HEAD", "PUT", "OPTIONS", "DELETE":
                retryable = true
        }
 
-       // POST and DELETE are not safe to retry automatically, so we minimize
-       // such failures by always using a new or recently active socket
-       if method == "POST" || method == "DELETE" {
+       // Non-retryable methods such as POST are not safe to retry automatically,
+       // so we minimize such failures by always using a new or recently active socket
+       if !retryable {
                if time.Since(c.lastClosedIdlesAt) > MaxIdleConnectionDuration {
                        c.lastClosedIdlesAt = time.Now()
                        c.Client.Transport.(*http.Transport).CloseIdleConnections()
@@ -273,7 +273,7 @@ func newAPIServerError(ServerAddress string, resp *http.Response) APIServerError
 // Returns a non-nil error if an error occurs making the API call, the
 // API responds with a non-successful HTTP status, or an error occurs
 // parsing the response body.
-func (c ArvadosClient) Call(method string, resourceType string, uuid string, action string, parameters Dict, output interface{}) error {
+func (c ArvadosClient) Call(method, resourceType, uuid, action string, parameters Dict, output interface{}) error {
        reader, err := c.CallRaw(method, resourceType, uuid, action, parameters)
        if reader != nil {
                defer reader.Close()