summaryrefslogtreecommitdiff
path: root/internal/api/cache.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-05-24 12:35:42 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-05-24 13:25:11 +0200
commit575a0a53b149ac2da21e368ef809dd2180a878f5 (patch)
tree539b883e597c4b4ed010208cf7583503ffddfe90 /internal/api/cache.go
parent8b6a7cec50711e5568abb416c87ef3995341b377 (diff)
API Test: Mock Transport by passing it around
Diffstat (limited to 'internal/api/cache.go')
-rw-r--r--internal/api/cache.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/api/cache.go b/internal/api/cache.go
index 4777334..420a4b0 100644
--- a/internal/api/cache.go
+++ b/internal/api/cache.go
@@ -2,6 +2,7 @@ package api
import (
"context"
+ "net/http"
"sync"
"time"
@@ -16,7 +17,7 @@ type EndpointCache struct {
}
// Get() returns a cached or fresh endpoint cache copy
-func (ec *EndpointCache) Get(ctx context.Context, wk string) (*endpoints.Endpoints, error) {
+func (ec *EndpointCache) Get(ctx context.Context, wk string, transport http.RoundTripper) (*endpoints.Endpoints, error) {
ec.mu.Lock()
defer ec.mu.Unlock()
@@ -35,7 +36,7 @@ func (ec *EndpointCache) Get(ctx context.Context, wk string) (*endpoints.Endpoin
}
// get fresh API endpoints
- ep, err := getEndpoints(ctx, wk)
+ ep, err := getEndpoints(ctx, wk, transport)
if err != nil {
return nil, err
}