From 3d68cdc8b345898726f695e3b334681dd072fbd0 Mon Sep 17 00:00:00 2001 From: Aitan Grossman Date: Wed, 18 Sep 2024 16:19:32 -0700 Subject: [PATCH] url.PathEscape path params --- src/main/resources/handlebars/go/api.mustache | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/handlebars/go/api.mustache b/src/main/resources/handlebars/go/api.mustache index 0b571ee575..97ae4a7e29 100644 --- a/src/main/resources/handlebars/go/api.mustache +++ b/src/main/resources/handlebars/go/api.mustache @@ -1,4 +1,3 @@ - {{>partial_header}} package {{packageName}} @@ -64,7 +63,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} // create path and map variables localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}} - localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}} + localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", url.PathEscape({{paramName}})), -1){{/pathParams}} localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -275,4 +274,4 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, nil } -{{/@first}}{{/contents}}{{/operation}}{{/operations}} \ No newline at end of file +{{/@first}}{{/contents}}{{/operation}}{{/operations}}