Skip to content

Commit

Permalink
Stash
Browse files Browse the repository at this point in the history
Fix SupportedDomain(), to make it return a host and not a full url.

Signed-off-by: Soule BA <[email protected]>
  • Loading branch information
souleb committed Nov 8, 2021
1 parent c95a496 commit 62fa116
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions stash/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ func Test_DomainVariations(t *testing.T) {
}{
{
name: "custom domain without protocol",
opts: gitprovider.WithDomain("stash.stashtestserver.link"),
want: "https://stash.stashtestserver.link",
opts: gitprovider.WithDomain("stash.testserver.link"),
want: "stash.testserver.link",
},
{
name: "custom domain with port",
opts: gitprovider.WithDomain("stash.stashtestserver.link:7990"),
want: "https://stash.stashtestserver.link:7990",
opts: gitprovider.WithDomain("stash.testserver.link:8990"),
want: "stash.testserver.link:8990",
},
{
name: "custom domain with https protocol",
opts: gitprovider.WithDomain("https://stash.stashtestserver.link:7990"),
want: "https://stash.stashtestserver.link:7990",
opts: gitprovider.WithDomain("https://stash.testserver.link:8990"),
want: "stash.testserver.link:8990",
},
{
name: "custom domain with http protocol",
opts: gitprovider.WithDomain("http://stash.stashtestserver.link:7990"),
want: "http://stash.stashtestserver.link:7990",
opts: gitprovider.WithDomain("http://stash.testserver.link:8990"),
want: "stash.testserver.link:8990",
},
}
for _, tt := range tests {
Expand Down
4 changes: 2 additions & 2 deletions stash/stash.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ type ProviderClient struct {
userRepos *UserRepositoriesClient
}

// SupportedDomain returns the host endpoint for this client, e.g. "https://mystash.com:7990"
// SupportedDomain returns the host endpoint for this client, e.g. "mystash.com:7990"
// This allows a higher-level user to know what Client to use for what endpoints.
// This field is set at client creation time, and can't be changed.
func (p *ProviderClient) SupportedDomain() string {
return p.client.BaseURL.String()
return p.client.BaseURL.Host
}

// ProviderID returns the provider ID "gostash..
Expand Down

0 comments on commit 62fa116

Please sign in to comment.