fix lint checks

This commit is contained in:
Bruce MacDonald 2024-11-27 15:45:45 -08:00
parent d0769313ed
commit a4b32736cf

View File

@ -17,9 +17,12 @@ import (
func TestMakeRequestWithRetry(t *testing.T) { func TestMakeRequestWithRetry(t *testing.T) {
authServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { authServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{ err := json.NewEncoder(w).Encode(map[string]string{
"token": "test-token", "token": "test-token",
}) })
if err != nil {
t.Errorf("failed to encode response: %v", err)
}
})) }))
defer authServer.Close() defer authServer.Close()
@ -35,7 +38,9 @@ func TestMakeRequestWithRetry(t *testing.T) {
name: "successful request", name: "successful request",
serverHandler: func(w http.ResponseWriter, r *http.Request) { serverHandler: func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Write([]byte("success")) if _, err := w.Write([]byte("success")); err != nil {
t.Errorf("failed to write response: %v", err)
}
}, },
method: http.MethodGet, method: http.MethodGet,
wantStatus: http.StatusOK, wantStatus: http.StatusOK,
@ -57,7 +62,9 @@ func TestMakeRequestWithRetry(t *testing.T) {
return return
} }
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
buf.ReadFrom(r.Body) if _, err := buf.ReadFrom(r.Body); err != nil {
t.Errorf("failed to read request body: %v", err)
}
if buf.String() != `{"key": "value"}` { if buf.String() != `{"key": "value"}` {
t.Errorf("body not preserved on retry, got %s", buf.String()) t.Errorf("body not preserved on retry, got %s", buf.String())
} }