Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Commit 50ac860

Browse files
authored
Remove leading slash in clients (#1547)
This is required so that ResolveReference resolves relative to the provided path.
1 parent c4c2832 commit 50ac860

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

internal/clients/clients.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func newClient(base, apiKey string, opts ...Option) (*client, error) {
8181
// newRequest creates a new request with the given method, path (relative to the
8282
// baseURL), and optional body. If the body is given, it's encoded as json.
8383
func (c *client) newRequest(ctx context.Context, method, pth string, body interface{}) (*http.Request, error) {
84+
pth = strings.TrimPrefix(pth, "/")
8485
u := c.baseURL.ResolveReference(&url.URL{Path: pth})
8586

8687
var b bytes.Buffer

0 commit comments

Comments
 (0)