From e9342e509f425e0bfb6a4a89b3fff2206feadf90 Mon Sep 17 00:00:00 2001 From: Tyler McGoffin Date: Thu, 10 Oct 2024 16:05:12 -0700 Subject: [PATCH] Change IsEnterprise name to IsServer --- pkg/api/graphql_client.go | 2 +- pkg/api/hosts.go | 2 +- pkg/api/hosts_test.go | 4 ++-- pkg/api/rest_client.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/api/graphql_client.go b/pkg/api/graphql_client.go index 515ce02..56d2ae7 100644 --- a/pkg/api/graphql_client.go +++ b/pkg/api/graphql_client.go @@ -172,7 +172,7 @@ func graphQLEndpoint(host string) string { return fmt.Sprintf("https://%s/api/graphql", host) } host = normalizeHostname(host) - if IsEnterprise(host) { + if IsServer(host) { return fmt.Sprintf("https://%s/api/graphql", host) } if strings.EqualFold(host, Localhost.String()) { diff --git a/pkg/api/hosts.go b/pkg/api/hosts.go index d389143..7e58cdf 100644 --- a/pkg/api/hosts.go +++ b/pkg/api/hosts.go @@ -30,7 +30,7 @@ func isGarage(host string) bool { return ToHost(host) == Garage } -func IsEnterprise(host string) bool { +func IsServer(host string) bool { typedHost := ToHost(host) return typedHost != GitHub && typedHost != Tenancy && typedHost != Garage || typedHost != Localhost } diff --git a/pkg/api/hosts_test.go b/pkg/api/hosts_test.go index f43b912..c5136cb 100644 --- a/pkg/api/hosts_test.go +++ b/pkg/api/hosts_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestIsEnterprise(t *testing.T) { +func TestIsServer(t *testing.T) { tests := []struct { name string host string @@ -31,7 +31,7 @@ func TestIsEnterprise(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - out := IsEnterprise(tt.host) + out := IsServer(tt.host) assert.Equal(t, tt.wantOut, out) }) } diff --git a/pkg/api/rest_client.go b/pkg/api/rest_client.go index dec7649..2bcbea7 100644 --- a/pkg/api/rest_client.go +++ b/pkg/api/rest_client.go @@ -160,7 +160,7 @@ func restPrefix(hostname string) string { return fmt.Sprintf("https://%s/api/v3/", hostname) } hostname = normalizeHostname(hostname) - if IsEnterprise(hostname) { + if IsServer(hostname) { return fmt.Sprintf("https://%s/api/v3/", hostname) } if strings.EqualFold(hostname, Localhost.String()) {