Skip to content

Commit 22f0df8

Browse files
lpcoxCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 1b9924b commit 22f0df8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/envutil/github_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,14 @@ func TestLookupGitHubAPIURL(t *testing.T) {
8484
t.Setenv("GITHUB_API_URL", "https://github.example.com/api/v3/")
8585
assert.Equal(t, "https://github.example.com/api/v3", LookupGitHubAPIURL(defaultURL))
8686
})
87+
88+
t.Run("returns default for whitespace-only env", func(t *testing.T) {
89+
t.Setenv("GITHUB_API_URL", " ")
90+
assert.Equal(t, defaultURL, LookupGitHubAPIURL(defaultURL))
91+
})
92+
93+
t.Run("trims whitespace before stripping trailing slash", func(t *testing.T) {
94+
t.Setenv("GITHUB_API_URL", " https://github.example.com/api/v3/ ")
95+
assert.Equal(t, "https://github.example.com/api/v3", LookupGitHubAPIURL(defaultURL))
96+
})
8797
}

0 commit comments

Comments
 (0)