summaryrefslogtreecommitdiff
path: root/client/gitlabnet.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/gitlabnet.go')
-rw-r--r--client/gitlabnet.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/client/gitlabnet.go b/client/gitlabnet.go
index c34f148..a4f59d8 100644
--- a/client/gitlabnet.go
+++ b/client/gitlabnet.go
@@ -85,6 +85,10 @@ func normalizePath(path string) string {
return path
}
+func appendPath(host string, path string) string {
+ return strings.TrimSuffix(host, "/") + "/" + strings.TrimPrefix(path, "/")
+}
+
func newRequest(ctx context.Context, method, host, path string, data interface{}) (*http.Request, error) {
var jsonReader io.Reader
if data != nil {
@@ -96,7 +100,7 @@ func newRequest(ctx context.Context, method, host, path string, data interface{}
jsonReader = bytes.NewReader(jsonData)
}
- request, err := http.NewRequestWithContext(ctx, method, host+path, jsonReader)
+ request, err := http.NewRequestWithContext(ctx, method, appendPath(host, path), jsonReader)
if err != nil {
return nil, err
}