diff --git a/pkg/ocm/provider/authorizer/json/json.go b/pkg/ocm/provider/authorizer/json/json.go index a47ef6b778..fc3eb0c891 100644 --- a/pkg/ocm/provider/authorizer/json/json.go +++ b/pkg/ocm/provider/authorizer/json/json.go @@ -104,7 +104,7 @@ func normalizeDomain(d string) (string, error) { return "", err } - return u.Hostname(), nil + return u.Host, nil } func (a *authorizer) GetInfoByDomain(_ context.Context, domain string) (*ocmprovider.ProviderInfo, error) { diff --git a/pkg/ocm/provider/authorizer/json/json_test.go b/pkg/ocm/provider/authorizer/json/json_test.go index 04c9f5b290..52c525733b 100644 --- a/pkg/ocm/provider/authorizer/json/json_test.go +++ b/pkg/ocm/provider/authorizer/json/json_test.go @@ -24,9 +24,10 @@ func TestAuthorizer_GetInfoByDomain(t *testing.T) { expectedDomain string expectedError error }{ - "domain only": {givenDomain: "server-one:9200", expectedDomain: "server-one"}, - "domain with port": {givenDomain: "server-two:9200", expectedDomain: "server-two:9200"}, - "unknown domain": {givenDomain: "unknown-domain", expectedError: errtypes.NotFound("unknown-domain")}, + "domain only": {givenDomain: "server-one", expectedDomain: "server-one"}, + "domain with port": {givenDomain: "server-two:9200", expectedDomain: "server-two:9200"}, + "domain only with port in result": {givenDomain: "server-two", expectedDomain: "server-two:9200"}, + "unknown domain": {givenDomain: "unknown-domain", expectedError: errtypes.NotFound("unknown-domain")}, } { t.Run(name, func(t *testing.T) { info, err := authorizer.GetInfoByDomain(context.Background(), env.givenDomain)