Skip to content

Commit 4be7e98

Browse files
authored
fix(apitester): do localhost check against hostname rather than the whole host (#4305)
The `host` will include both the hostname and the port, so we should be instead comparing against just the hostname
1 parent bd1173a commit 4be7e98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/apitester/internal/vcr/interactions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func Play(t *testing.T, interaction *cassette.Interaction) *http.Response {
3535
req.Header.Set("User-Agent", "osv.dev/apitester")
3636
req.ContentLength = -1
3737

38-
if req.URL.Host == "localhost" || req.URL.Host == "127.0.0.1" {
38+
if req.URL.Hostname() == "localhost" || req.URL.Hostname() == "127.0.0.1" {
3939
req.URL.Scheme = "http"
4040
}
4141

0 commit comments

Comments
 (0)