From c6a9c970b0dd6cf500614e23b3afdfbd11cbb51c Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 5 May 2020 16:32:27 -0400 Subject: [PATCH] Don't require project in generated client requests --- api/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/client.go b/api/client.go index 5a6c647003..391430e2b8 100644 --- a/api/client.go +++ b/api/client.go @@ -689,13 +689,18 @@ func (c *Client) NewRequest(ctx context.Context, method, requestPath string, bod } } + orgProjPath := path.Join("org", org) + if project != "" { + orgProjPath = path.Join(orgProjPath, "project", project) + } + req := &http.Request{ Method: method, URL: &url.URL{ User: u.User, Scheme: u.Scheme, Host: host, - Path: path.Join(u.Path, "v1", "org", org, "project", project, requestPath), + Path: path.Join(u.Path, "v1", orgProjPath, requestPath), }, Host: u.Host, }