Skip to content

Commit 5bd37ed

Browse files
authored
Merge pull request #17 from batonogov/main
2 parents 4709988 + bf9f389 commit 5bd37ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/client/api_client.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ func (cl *APIClient) get(ctx context.Context, path string) ([]byte, error) {
101101
cl.sem.Acquire(context.Background(), 1)
102102
defer cl.sem.Release(1)
103103

104-
uri := strings.Trim(cl.url, "/") + "/" + strings.Trim(path, "/")
104+
baseURL := strings.TrimSuffix(cl.url, "/")
105+
relativePath := strings.TrimPrefix(path, "/")
106+
107+
uri := baseURL
108+
if relativePath != "" {
109+
uri += "/" + relativePath
110+
}
105111

106112
_, span := cl.tracer.Start(ctx, "Client.Get", trace.WithAttributes(
107113
attribute.String("URI", uri),

0 commit comments

Comments
 (0)