Skip to content

Commit

Permalink
retrieve hostname only
Browse files Browse the repository at this point in the history
  • Loading branch information
sarumaj authored Oct 4, 2023
1 parent bcb5211 commit 8c54e6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/restclient/rest_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8c54e6f

Please sign in to comment.