Skip to content

Commit f910ba8

Browse files
CR-5764 trailing slash bug (#137)
* trim "/" from opt.Host when creating Codefresh object
1 parent dc70f95 commit f910ba8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.35.0
1+
0.35.1

pkg/codefresh/codefresh.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"io/ioutil"
1010
"net/http"
11+
"regexp"
1112
"strings"
1213

1314
"github.com/google/go-querystring/query"
@@ -48,6 +49,14 @@ func New(opt *ClientOptions) Codefresh {
4849
httpClient = opt.Client
4950
}
5051

52+
re := regexp.MustCompile("/$")
53+
54+
if re.FindString(opt.Host) != "" {
55+
if len(opt.Host) > 1 {
56+
opt.Host = opt.Host[:len(opt.Host) - 1]
57+
}
58+
}
59+
5160
return &codefresh{
5261
host: opt.Host,
5362
token: opt.Auth.Token,

0 commit comments

Comments
 (0)