url.PathEscape resource ids in the sdk before sending building a request. (#2035)

This commit is contained in:
Todd authored and GitHub committed 2022-04-27 08:13:46 -07:00
1 parent 89196f2ce7
commit a1cf3234ed
29 files changed
+199 -87

No files matched your search

+3 -3
View File
@@ -143,7 +143,7 @@ func (c *Client) Read(ctx context.Context, id string, opt ...Option) (*ManagedGr
opts, apiOpts := getOpts(opt...)
req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("managed-groups/%s", id), nil, apiOpts...)
req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("managed-groups/%s", url.PathEscape(id)), nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating Read request: %w", err)
}
@@ -206,7 +206,7 @@ func (c *Client) Update(ctx context.Context, id string, version uint32, opt ...O
opts.postMap["version"] = version
req, err := c.client.NewRequest(ctx, "PATCH", fmt.Sprintf("managed-groups/%s", id), opts.postMap, apiOpts...)
req, err := c.client.NewRequest(ctx, "PATCH", fmt.Sprintf("managed-groups/%s", url.PathEscape(id)), opts.postMap, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating Update request: %w", err)
}
@@ -247,7 +247,7 @@ func (c *Client) Delete(ctx context.Context, id string, opt ...Option) (*Managed
opts, apiOpts := getOpts(opt...)
req, err := c.client.NewRequest(ctx, "DELETE", fmt.Sprintf("managed-groups/%s", id), nil, apiOpts...)
req, err := c.client.NewRequest(ctx, "DELETE", fmt.Sprintf("managed-groups/%s", url.PathEscape(id)), nil, apiOpts...)
if err != nil {
return nil, fmt.Errorf("error creating Delete request: %w", err)
}