From 62fa116ace035e8c5282fbf6c0e7d2aaae0b2af3 Mon Sep 17 00:00:00 2001 From: Soule BA Date: Mon, 8 Nov 2021 23:28:41 +0100 Subject: [PATCH] Stash Fix SupportedDomain(), to make it return a host and not a full url. Signed-off-by: Soule BA --- stash/auth_test.go | 16 ++++++++-------- stash/stash.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/stash/auth_test.go b/stash/auth_test.go index f8dd5293..fb0b98b3 100644 --- a/stash/auth_test.go +++ b/stash/auth_test.go @@ -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 { diff --git a/stash/stash.go b/stash/stash.go index e8b3e5a8..9f9b4fea 100644 --- a/stash/stash.go +++ b/stash/stash.go @@ -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..