diff --git a/pkg/restclient/rest_client.go b/pkg/restclient/rest_client.go index b62225f..9035145 100644 --- a/pkg/restclient/rest_client.go +++ b/pkg/restclient/rest_client.go @@ -4,7 +4,7 @@ import ( "context" "io" "net/http" - "strings" + "net/url" "github.com/cli/go-gh/v2/pkg/api" "github.com/sarumaj/gh-gr/pkg/configfile" @@ -58,7 +58,9 @@ func (c RESTClient) GetUserOrgs(ctx context.Context) ([]resources.Organization, } func NewRESTClient(conf *configfile.Configuration, options ClientOptions) (*RESTClient, error) { - options.Host = strings.TrimSuffix(options.Host, "/") + if parsed, err := url.Parse(options.Host); err == nil { + options.Host = parsed.Hostname() + } client, err := api.NewRESTClient(options) if err != nil {