Skip to content

Commit 20b4808

Browse files
feat(client): allow custom baseurls without trailing slash (#55)
1 parent a5f0af7 commit 20b4808

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

option/requestoption.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"log"
1010
"net/http"
1111
"net/url"
12+
"strings"
1213
"time"
1314

1415
"github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig"
@@ -29,6 +30,9 @@ func WithBaseURL(base string) RequestOption {
2930
log.Fatalf("failed to parse BaseURL: %s\n", err)
3031
}
3132
return func(r *requestconfig.RequestConfig) error {
33+
if u.Path != "" && !strings.HasSuffix(u.Path, "/") {
34+
u.Path += "/"
35+
}
3236
r.BaseURL = u
3337
return nil
3438
}

0 commit comments

Comments
 (0)