Skip to content

Commit bfc42b0

Browse files
committed
fix: use unique variable name
1 parent 86ad5d5 commit bfc42b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/go/api_test.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ func Test_{{packageName}}_{{classname}}Service(t *testing.T) {
2727
{{#operations}}
2828
{{#operation}}
2929
t.Run("Test {{classname}}Service {{{nickname}}}", func(t *testing.T) {
30-
path := "{{{path}}}"{{#pathParams}}
30+
_apiUrlPath := "{{{path}}}"{{#pathParams}}
3131
{{paramName}}Value := {{#isString}}"{{paramName}}"{{/isString}}{{#isNumber}}123{{/isNumber}}{{#isFloat}}float32(123){{/isFloat}}{{#isDouble}}float64(123){{/isDouble}}{{#isInteger}}int32(123){{/isInteger}}{{#isLong}}int64(123){{/isLong}}{{^isString}}{{^isInteger}}{{defaultValue}}{{/isInteger}}{{/isString}}
32-
path = strings.Replace(path, "{"+"{{baseName}}"+"}", url.PathEscape(ParameterValueToString({{paramName}}Value, "{{paramName}}")), -1){{/pathParams}}
32+
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"{{baseName}}"+"}", url.PathEscape(ParameterValueToString({{paramName}}Value, "{{paramName}}")), -1){{/pathParams}}
3333

3434
test{{classname}}ServeMux := http.NewServeMux()
35-
test{{classname}}ServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) {
35+
test{{classname}}ServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
3636
{{! Only binary data sets a ReturnFormat}}
3737
{{#returnFormat}}
3838
w.Header().Add("Content-Type", "application/octet-stream")

0 commit comments

Comments
 (0)