Move update versioning to query parameter, and fix up scope API tests (#244)

* Move update versioning to query parameter, and fix up scope API tests

* Add version checks for update requests in other services
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-08-07 17:56:55 -04:00
1 parent 0d0660b061
commit bbd200101f
16 files changed
+240 -102

No files matched your search

+5
View File
@@ -4,6 +4,7 @@ package authmethods
import (
"context"
"fmt"
"net/url"
"time"
"github.com/hashicorp/watchtower/api"
@@ -113,6 +114,10 @@ func (c *accountsClient) Update(ctx context.Context, authMethodId string, accoun
return nil, nil, fmt.Errorf("error creating Update request: %w", err)
}
q := url.Values{}
q.Add("version", fmt.Sprintf("%d", version))
req.URL.RawQuery = q.Encode()
resp, err := c.client.Do(req)
if err != nil {
return nil, nil, fmt.Errorf("error performing client request during Update call: %w", err)