package v1 import ( "net/http" "net/http/httptest" "strings" "testing" "git.unkin.net/unkin/artifactapi/internal/provider/nuget" "git.unkin.net/unkin/artifactapi/pkg/models" ) func TestValidHost(t *testing.T) { for _, h := range []string{"aa.example", "aa.example:8443", "artifactapi.k8s.syd1.au.unkin.net", "10.0.0.1:80", "[::1]:8080", "[::1]", "::1", "localhost", "my_host.local"} { if !validHost(h) { t.Errorf("validHost(%q) = false, want true", h) } } for _, h := range []string{"", "evil\".example", "a b", "aa.example:0", "aa.example:99999", "aa.example:x", "aa.example:", ":8080", "-bad.example", "a..b", "[::1", "[nope]:80", "a/b", "a