File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,16 @@ func NewClient(opts ClientOptions) (MicrocksClient, error) {
130130 c .AuthToken = configCtx .User .AuthToken
131131 c .RefreshToken = configCtx .User .RefreshToken
132132
133- apiurl := configCtx .Server .Server
133+ apiURL := configCtx .Server .Server
134134
135- if ! strings .HasSuffix (apiurl , "/api/" ) {
136- apiurl += "/api/"
135+ if strings .HasSuffix (apiURL , "/api" ) {
136+ apiURL += "/"
137+ }
138+ if ! strings .HasSuffix (apiURL , "/api/" ) {
139+ apiURL += "/api/"
137140 }
138141
139- u , err := url .Parse (apiurl )
142+ u , err := url .Parse (apiURL )
140143 if err != nil {
141144 panic (err )
142145 }
@@ -172,6 +175,9 @@ func NewClient(opts ClientOptions) (MicrocksClient, error) {
172175func NewMicrocksClient (apiURL string ) MicrocksClient {
173176 mc := microcksClient {}
174177
178+ if strings .HasSuffix (apiURL , "/api" ) {
179+ apiURL += "/"
180+ }
175181 if ! strings .HasSuffix (apiURL , "/api/" ) {
176182 apiURL += "/api/"
177183 }
@@ -193,7 +199,6 @@ func NewMicrocksClient(apiURL string) MicrocksClient {
193199 }
194200 return & mc
195201}
196-
197202func (c * microcksClient ) HttpClient () * http.Client {
198203 return c .httpClient
199204}
You can’t perform that action at this time.
0 commit comments