Fix module "go-server" - template "controller-api.mustache" : query.Get() must use {{baseName}} instead of {{paramName}} on boolean and default query parameters (#9580)

This commit is contained in:
ricou13770 2021-06-03 04:02:00 +02:00 committed by GitHub
parent 439a1a9ba2
commit 2b495fc7a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,7 +90,7 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
} }
{{/isInteger}} {{/isInteger}}
{{#isBoolean}} {{#isBoolean}}
{{paramName}}, err := parseBoolParameter(query.Get("{{paramName}}")) {{paramName}}, err := parseBoolParameter(query.Get("{{baseName}}"))
if err != nil { if err != nil {
w.WriteHeader(500) w.WriteHeader(500)
return return
@ -99,7 +99,7 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
{{^isLong}} {{^isLong}}
{{^isInteger}} {{^isInteger}}
{{^isBoolean}} {{^isBoolean}}
{{paramName}} := {{#isArray}}strings.Split({{/isArray}}query.Get("{{paramName}}"){{#isArray}}, ","){{/isArray}} {{paramName}} := {{#isArray}}strings.Split({{/isArray}}query.Get("{{baseName}}"){{#isArray}}, ","){{/isArray}}
{{/isBoolean}} {{/isBoolean}}
{{/isInteger}} {{/isInteger}}
{{/isLong}} {{/isLong}}