diff --git a/.circleci/config.yml b/.circleci/config.yml index ab886586..61535ae0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ workflows: name: 'test_go_<< matrix.go_version >>' matrix: parameters: - go_version: ['1.13', '1.14', '1.15', '1.16', '1.17'] + go_version: ['1.15', '1.16', '1.17'] jobs: test: diff --git a/client/v2/common/common.go b/client/v2/common/common.go index 8e6068e9..2314fd6c 100644 --- a/client/v2/common/common.go +++ b/client/v2/common/common.go @@ -241,3 +241,19 @@ func (client *Client) GetRawMsgpack(ctx context.Context, response interface{}, p func (client *Client) Post(ctx context.Context, response interface{}, path string, body interface{}, headers []*Header) error { return client.submitForm(ctx, response, path, body, "POST", true /* encodeJSON */, headers) } + +// Helper function for correctly formatting and escaping URL path parameters. +// Used in the generated API client code. +func EscapeParams(params ...interface{}) []interface{} { + paramsStr := make([]interface{}, len(params)) + for i, param := range params { + switch v := param.(type) { + case string: + paramsStr[i] = url.PathEscape(v) + default: + paramsStr[i] = fmt.Sprintf("%v", v) + } + } + + return paramsStr +}