aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2024-07-08 15:46:38 +0200
committerStefan Majewsky <majewsky@gmx.net>2024-07-08 15:58:48 +0200
commitf874c88ee641881229b74bc5afa8f2490120d91b (patch)
treeb659e602831cefdea385dd021d45501c1c29c6d2 /account.go
parent4fac97b5e944ce70cdca3679f5c2b1eef9b83952 (diff)
downloadgo-schwift-f874c88ee641881229b74bc5afa8f2490120d91b.tar.gz
add ctx argument to Account.Capabilities
Diffstat (limited to 'account.go')
-rw-r--r--account.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/account.go b/account.go
index 3b37b17..cfc5b31 100644
--- a/account.go
+++ b/account.go
@@ -189,7 +189,7 @@ func (a *Account) Containers() *ContainerIterator {
// Capabilities queries the GET /info endpoint of the Swift server providing
// this account. Capabilities are cached, so the GET request will only be sent
// once during the first call to this method.
-func (a *Account) Capabilities() (Capabilities, error) {
+func (a *Account) Capabilities(ctx context.Context) (Capabilities, error) {
a.capsMutex.Lock()
defer a.capsMutex.Unlock()
@@ -197,7 +197,7 @@ func (a *Account) Capabilities() (Capabilities, error) {
return *a.caps, nil
}
- buf, err := a.RawCapabilities()
+ buf, err := a.RawCapabilities(ctx)
if err != nil {
return Capabilities{}, err
}
@@ -215,10 +215,10 @@ func (a *Account) Capabilities() (Capabilities, error) {
// RawCapabilities queries the GET /info endpoint of the Swift server providing
// this account, and returns the response body. Unlike Account.Capabilities,
// this method does not employ any caching.
-func (a *Account) RawCapabilities() ([]byte, error) {
+func (a *Account) RawCapabilities(ctx context.Context) ([]byte, error) {
// This method is the only one in Schwift that bypasses struct Request since
// the request URL is not below the endpoint URL.
- req, err := http.NewRequestWithContext(context.TODO(), http.MethodGet, a.baseURL+"info", http.NoBody)
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, a.baseURL+"info", http.NoBody)
if err != nil {
return nil, err
}