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()
// 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()