diff --git a/github/client.go b/github/client.go index a778d9c..dabb51d 100644 --- a/github/client.go +++ b/github/client.go @@ -319,6 +319,7 @@ func (c *Client) doRequest(ctx context.Context, method, reqURL string, accept st timer := time.NewTimer(delay) select { case <-timer.C: + timer.Stop() // no-op after fire; kept for symmetry with the ctx.Done case case <-ctx.Done(): timer.Stop() return nil, ctx.Err() diff --git a/github/client_test.go b/github/client_test.go index 3d5fa4e..6d2afa6 100644 --- a/github/client_test.go +++ b/github/client_test.go @@ -544,6 +544,7 @@ func TestNoInsecureOption_RejectsHTTP(t *testing.T) { t.Errorf("unexpected error message: %v", err) } } + func TestNoInsecureOption_RejectsUppercaseHTTP(t *testing.T) { // Verify case-insensitive scheme check (RFC 3986). c := NewClient("tok", "HTTP://example.com") @@ -568,7 +569,6 @@ func TestNoInsecureOption_RejectsMixedCaseHTTP(t *testing.T) { } } - func TestAllowInsecureHTTP_WithoutEnvVar_Rejected(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { t.Fatal("request should not have been sent")