add mutex for test field

Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
Meredith Lancaster 2025-01-06 13:14:02 -07:00
parent fb4fc7e7c2
commit 69865117ab

View file

@ -5,18 +5,22 @@ import (
"fmt"
"io"
"net/http"
"sync"
"github.com/cli/cli/v2/pkg/cmd/attestation/test/data"
"github.com/golang/snappy"
)
type mockHttpClient struct {
mutex sync.RWMutex
called bool
OnGet func(url string) (*http.Response, error)
}
func (m *mockHttpClient) Get(url string) (*http.Response, error) {
m.mutex.Lock()
m.called = true
m.mutex.Unlock()
return m.OnGet(url)
}